public ActionResult Edit(RestaurantAddressInput input) { if (!ModelState.IsValid) { return(PartialView("Create", input)); } var address = Db.Get <RestaurantAddress>(input.Id); address.Line1 = input.Line1; address.Line2 = input.Line2; return(Json(new { input.Id })); }
public ActionResult Create(RestaurantAddressInput input) { if (!ModelState.IsValid) { return(PartialView(input)); } var address = Db.Insert(new RestaurantAddress { Line1 = input.Line1, Line2 = input.Line2, RestaurantId = input.RestaurantId }); return(Json(address)); // use MapToGridModel like in Grid Crud Demo when grid uses Map }
public ActionResult Edit(RestaurantAddressInput input) { if (!ModelState.IsValid) { return(Json(ModelState.GetErrorsInline())); } var ent = Db.Get <RestaurantAddress>(input.Id); ent.Line1 = input.Line1; ent.Line2 = input.Line2; Db.Update(ent); return(Json(new { })); }
public ActionResult Create(RestaurantAddressInput input) { if (!ModelState.IsValid) { return(Json(ModelState.GetErrorsInline())); } var ent = Db.Insert(new RestaurantAddress { RestaurantId = input.RestaurantId, Line1 = input.Line1, Line2 = input.Line2 }); return(Json(new { Item = MapToGridModel(ent) })); }