public JsonResult Edit(OutOfPlanProductViewModel model) { // var products = _productDomain.GetByCode(model.ProductCode); //if (model.Fraction > products.F09_PackingUnit) // return Json(new { Success = false, Message = ProductManagementResources.MSG15 }, // JsonRequestBehavior.AllowGet); // if (ModelState.IsValid) try { var item = Mapper.Map <OutOfPlanProductItem>(model); var isSuccess = _outOfPlanProductDomain.CreateOrUpdate(item, model.IsCreate); 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)); } //return Json(new { Success = false }, JsonRequestBehavior.AllowGet); }
// GET: ProductManagement/OutOfPlanOfProduct public ActionResult Index() { ViewBag.ScreenId = Constants.PictureNo.TCPR141F; var model = new OutOfPlanProductViewModel { GridOutOfPlanProduct = GenerateGridOutOfPlanProduct() }; return(View(model)); }
public ActionResult Edit(string productCode, string prePdtLotNo) { var model = new OutOfPlanProductViewModel { IsCreate = true, F58_TbtEndDateString = DateTime.Now.ToString("dd/MM/yyyy") }; if (!string.IsNullOrEmpty(productCode)) { var entity = _outOfPlanProductDomain.GetByProductsCode(productCode, prePdtLotNo); if (entity != null) { model = Mapper.Map <OutOfPlanProductViewModel>(entity); model.IsCreate = false; //string datetime = model.TableEnDate.ToString("dd/MM/yyyy"); //model.TableEnDate = Convert.ToDateTime(datetime); } } return(PartialView("OutOfPlanProduct/_PartialViewEditOutOfPlanProduct", model)); }