how to put the list data obtained from database to another variable in c# mvc using petapoco

268 views Asked by At

I have obtained the list of data from database in the following way

List<MakerCheckerModel> mkckdata = new List<MakerCheckerModel>(); var dataContext = new PetaPoco.Database("MessageEntity"); mkckdata = dataContext.Query<MakerCheckerModel>(PetaPoco.Sql.Builder.Append("Select * from MakerChecker1")).ToList();

The data comes in mkckdata. My model is of the following way.

public class MakerCheckerModel
{

    public int MakerCheckerId { get; set; }
    public string OldJson { get; set; }
    public string NewJson { get; set; }
    public string ModelName { get; set; }

}

Now I want to put the value obtained in OldJson and NewJson of mkckdata in new List type of model variables so that I can manipulate it further.I want something like this.

List<MakerCheckerModel> oldDataList = new List<MakerCheckerModel>();
            oldDataList.Add(mkckdata.OldJson));

But this is not allowed here. PLease help me how to do this.

0

There are 0 answers