public ActionResult Edit([Bind(Include = "LocationCode,LocationName,LocationType")] Location location) { if (ModelState.IsValid) { service.EditLocation(location); return(RedirectToAction("Index")); } return(View(location)); }
public async Task <IActionResult> Edit(EditLocationViewModel model) { MessageVM userMessage = new MessageVM(); if (ModelState.IsValid) { if (await _locationServices.EditLocation(model)) { userMessage = new MessageVM() { CssClassName = "alert alert-success ", Title = "Thành công", Message = "Chỉnh sửa địa điểm thành công" }; TempData["UserMessage"] = JsonConvert.SerializeObject(userMessage); return(RedirectToAction(actionName: "Index")); } } userMessage = new MessageVM() { CssClassName = "alert alert-danger ", Title = "Không thành công", Message = "Thao tác thất bại, xin mời thử lại" }; TempData["UserMessage"] = JsonConvert.SerializeObject(userMessage); return(RedirectToAction(actionName: "Index")); }