public ActionResult CreateSub(PckMtrViewModel model) { try { var pckMtr = Mapper.Map <PckMtrItem>(model); _pckMtrDomain.CreateOrUpdate(pckMtr); return(Json( new { Success = true, Message = model.IsCreate ? MessageResource.MSG6 : MessageResource.MSG9 }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Success = false, ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult CreateSub(string productCode, string productName, string subMaterialCode) { var model = new PckMtrViewModel { IsCreate = true, F11_ProductCode = productCode, ProductName = productName }; if (!string.IsNullOrEmpty(subMaterialCode)) { var pkmtr = _pckMtrDomain.GetPckMtr(productCode, subMaterialCode); model = Mapper.Map <PckMtrViewModel>(pkmtr); model.SubMaterialName = _subMaterialDomain.GetById(subMaterialCode).F15_MaterialDsp; model.IsCreate = false; } return(PartialView("Product/_PartialViewAddSup", model)); }