public ActionResult getProperties(JqGridRequest request) { var context = new EFRepository(); var propertyList = from property in context.EFProperties where property.isDeleted == false select property; JqGridResponse jqGridResp = new JqGridResponse() { TotalPagesCount = (int)Math.Ceiling((float)propertyList.Count() / (float)request.RecordsCount), PageIndex = request.PageIndex, TotalRecordsCount = propertyList.Count() }; foreach (EFProperty p in propertyList) { PropSumGridModel psModel = new PropSumGridModel(); psModel.Id = p.Id.ToString(); psModel.Type = p.Type; psModel.Address = p.Address; psModel.City = p.City; psModel.State = p.State; psModel.Zip = p.Zip; var lienList = from lien in context.EFLiens where lien.PropertyId == p.Id && lien.LienPosition == "1" select lien; foreach (EFLien q in lienList) { psModel.Servicer = q.Servicer; psModel.Status = q.Status; } jqGridResp.Records.Add(new JqGridRecord(Convert.ToString(p.Id), new List <object>() { psModel.Id, psModel.Type, psModel.Address, psModel.City, psModel.State, psModel.Zip, psModel.Servicer, psModel.Status })); } return(new JqGridJsonResult() { Data = jqGridResp }); }
public ActionResult editProperty(string oper, PropSumGridModel editProperty) { var context = new EFRepository(); if (oper.Equals("edit")) { EFProperty p = new EFProperty(); p.Id = Convert.ToInt32(editProperty.Id); p.Type = editProperty.Type; p.Address = editProperty.Address; p.City = editProperty.City; p.State = editProperty.State; p.Zip = editProperty.Zip; context.Entry(p).State = EntityState.Modified; context.SaveChanges(); } return(Json(JSONResponseFactory.SuccessResponse())); }