public ActionResult Edit(int id = 0) { if (id == 0) { return(View(new TPOQCLimit())); } TPOQCLimit model = null; using (TPOQCLimitService svc = new TPOQCLimitService()) { var dto = svc.Get(id); model = AutoMapper.Mapper.Map <TPOQCLimitDto, TPOQCLimit>(dto); } if (model == null) { SetResponseMesssage(ActionTypeMessage.Error, General.ResponseMessageFailNoRecord); return(View()); } ViewBag.UseSecThick = GetUseSecThickOptions(); ViewBag.ThickUoM = GetThickUoMOptions(); ViewBag.ForceUoM = GetForceUoMOptions(); ViewBag.TempUoM = GetTempUoMOptions(); ViewBag.WeightUoM = GetWeightUoMOptions(); return(View(model)); }
public ActionResult Edit(TPOQCLimit model) { model.LastModified = DateTime.Now; model.ModifiedBy = CurrentUser; TPOQCLimitDto dto = AutoMapper.Mapper.Map <TPOQCLimit, TPOQCLimitDto>(model); using (TPOQCLimitService svc = new TPOQCLimitService()) { svc.Update(dto); } SetResponseMesssage(ActionTypeMessage.SuccessfulSave); return(RedirectToAction("Edit", new { id = model.Id })); }