public ActionResult addProperty(string oper, EFProperty addProperty) { var context = new EFRepository(); if (oper.Equals("add")) { EFProperty p = new EFProperty(); p.Id = 0; p.Type = addProperty.Type; p.Address = addProperty.Address; p.City = addProperty.City; p.State = addProperty.State; p.Zip = addProperty.Zip; context.EFProperties.Add(p); context.SaveChanges(); } return(Json(JSONResponseFactory.SuccessResponse())); }
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())); }