public JsonResult UpdateRoll(TPOReworkRollModel roll1, TPOReworkRollModel roll2 = null) { ResponseMessage response = new ResponseMessage(); try { using (TPOReworkRollService svc = new TPOReworkRollService()) { var dto = Mapper.Map(roll1, svc.Get(roll1.Id)); svc.Update(dto); if (roll2 != null) { var dto2 = Mapper.Map(roll2, svc.Get(roll2.Id)); svc.Update(dto2); } } response = SetResponseMesssage(Common.Enums.ActionTypeMessage.SuccessfulSave, "Measurements saved successfully."); } catch (Exception ex) { response = SetResponseMesssage(Common.Enums.ActionTypeMessage.FailedSave, "Failed to save measurements."); } return(Json(response, JsonRequestBehavior.AllowGet)); }
public JsonResult MasterRollsByPlant() { List <TPOReworkRollModel> models = new List <TPOReworkRollModel>(); using (TPOReworkRollService svc = new TPOReworkRollService()) { var dtos = svc.GetMasterRollsByPlant(CurrentPlantId); models.AddRange(Mapper.Map <List <TPOReworkRollDto>, List <TPOReworkRollModel> >(dtos)); } return(Json(models, JsonRequestBehavior.AllowGet)); }
public JsonResult FetchMasterRolls(int lineId, int?workOrderId) { List <TPOReworkRollModel> items = new List <TPOReworkRollModel>(); using (TPOReworkRollService service = new TPOReworkRollService()) { var dtos = service.GetMasterRollsByPlant(CurrentPlantId); AutoMapper.Mapper.Map(dtos, items); } return(Json(items, JsonRequestBehavior.AllowGet)); }