Ejemplo n.º 1
0
        public ActionResult Edit(string preProductCode, string materialCode, string preProductName)
        {
            var model = new PrePdtMkpViewModel {
                IsCreate = true
            };
            var preproduct = _preProductDomain.GetById(preProductCode);

            if (string.IsNullOrEmpty(materialCode.Trim()))
            {
                model.F02_PreProductCode = preProductCode;
                model.F03_PreProductName = preproduct != null ? preproduct.F03_PreProductName : preProductName;
                model.F02_Addtive        = "0";
                //  model.F02_ThrawSeqNo = (_prePdtMkpDomain.CountByPreproductCode(preProductCode)+1).ToString();
            }
            else
            {
                var entity = _prePdtMkpDomain.GetById(preProductCode, materialCode);
                if (entity != null)
                {
                    model = Mapper.Map <PrePdtMkpViewModel>(entity);
                    model.F03_PreProductName = preproduct != null ? preproduct.F03_PreProductName : preProductName;
                    var material = _materialDomain.GetById(materialCode);
                    model.F01_MaterialName = material.F01_MaterialDsp;
                    model.F01_LiquidClass  = material.Liquid;
                    model.F02_LoadPosition = model.F02_LoadPosition;
                    model.IsCreate         = false;
                }
            }

            return(PartialView("PreProduct/_PartialViewEditPrePdtMkp", model));
        }
Ejemplo n.º 2
0
 public ActionResult Edit(PrePdtMkpViewModel model)
 {
     try
     {
         var item      = Mapper.Map <PrePdtMkpItem>(model);
         var isSuccess = _prePdtMkpDomain.CreateOrUpdate(item);
         if (!isSuccess.IsSuccess)
         {
             return(Json(new { Success = false, Message = isSuccess.ErrorMessages }, JsonRequestBehavior.AllowGet));
         }
         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));
     }
 }