public ActionResult Edit(string id, bool isStore) { var model = new StorageOfSupplementaryMaterialViewModel(); if (!string.IsNullOrEmpty(id)) { var entity = _storageOfSupplementaryMaterialDomain.GetById(id); if (entity != null) { model = Mapper.Map <StorageOfSupplementaryMaterialViewModel>(entity); model.IsStore = isStore; } } return(PartialView("StorageOfSupplementaryMaterial/_PartialViewEditStorageOfSupplementaryMaterial", model)); }
public JsonResult Edit(StorageOfSupplementaryMaterialViewModel model) { if (ModelState.IsValid) { try { var item = Mapper.Map <StorageOfSupplementaryMaterialItem>(model); var isSuccess = _storageOfSupplementaryMaterialDomain.CreateOrUpdate(item); if (!isSuccess.IsSuccess) { return(Json(new { Success = false, Message = isSuccess.ErrorMessages }, JsonRequestBehavior.AllowGet)); } return(Json(new { Success = true, Message = MessageResource.MSG6 }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Success = false, ex.Message }, JsonRequestBehavior.AllowGet)); } } return(Json(new { Success = false }, JsonRequestBehavior.AllowGet)); }