Not able to get the data(ALL except DATETIME) from Database

Not able to get the data(ALL except DATETIME) from Database

kea0811kea0811 Posts: 10Questions: 2Answers: 1
edited July 2016 in Editor

I am working on a project in .NET . Is there a way that I can retrieve data without Model?

var response = new Editor(db, "problem", "Id")
                //.Model<Problem>()
                .TryCatch(false)
                .Field(new Field("problem.Id"))
                .Field(new Field("problem.Subject"))
                .Field(new Field("problem.Message"))
                .Field(new Field("problem.AttachmentUrl"))
                .Field(new Field("problem.UserID"))
                .Field(new Field("user.FirstName"))
                .Field(new Field("user.LastName"))
                .Field(new Field("problem.LastModified"))
                .Field(new Field("problem.DateCreated"))
                .LeftJoin("user", "user.Id", "=", "problem.UserID")
                .Where("problem.project", "PLAN", "=")
                .Process(request)
                .Data();

With this, I could retrieve all field except LastModified and DateCreated.

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Hi,

    Yes - the modal is absolutely optional. You can simply use Field( new Field(...) ) as you have done to define new fields. In fact all Editor does with the model is to read the properties from it and create new Field instances if they don't already exist.

    With this, I could retrieve all field except LastModified and DateCreated.

    What do you get for those two fields? It is possible you might need to use a get formatter.

    Allan

  • kea0811kea0811 Posts: 10Questions: 2Answers: 1

    it is just empty value for those 2 field.

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    Could you show me the JSON returned by the server please? Even better, if you have a link to the page that would be very useful.

    Also, did you try using a formatter to show the date in a "nice" format?

    Allan

  • kea0811kea0811 Posts: 10Questions: 2Answers: 1
    Answer ✓

    I manage to use the Model to get the value. Thank you very much!

This discussion has been closed.