public JsonResult Delete(CustomerModel model) { if (ModelState.IsValid) { return Json(_service.Delete(model)); } return Json(null); }
public ActionResult Edit(CustomerModel model) { if (model.Id == 0) { ModelState.Remove("Id"); } if (ModelState.IsValid) { JsonOperationModel<CustomerModel> operationResult; operationResult = model.Id == default(int) ? _service.Add(model) : _service.Edit(model); ImageType type = ImageType.Customer; if (operationResult.Result && Session[type.ToString()] != null) { _image.ReplaceImage(Session[type.ToString()].ToString(), type, model.Id); Session.Remove(type.ToString()); } return Json(operationResult); } return PartialView("EditorTemplates/_Edit", model); }