コード例 #1
0
 public JsonResult Delete(CustomerModel model)
 {
     if (ModelState.IsValid)
     {
         return Json(_service.Delete(model));
     }
     return Json(null);
 }
コード例 #2
0
 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);
 }