public Results AddUpdate(TransformationMapsVM model) { try { if (model.TransformationMapId == null) { unitOfWork.TransformationMapsRepo.Insert(model.TransformationMap); } else { unitOfWork.TransformationMapsRepo.Update(model.TransformationMap); } unitOfWork.TransformationMapsRepo.SaveChanges(); return(new Results() { Succeeded = true }); } catch (Exception e) { return(new Results() { Succeeded = false, Errors = new List <string>() { e.Message } }); } }
public IActionResult AddEditTransformMapDetail(TransformationMapsVM model) { model.Products = transformMapService.GetProducts(); if (!ModelState.IsValid) { return(PartialView("TransformMapDetailPartial", model)); } var results = transformMapService.AddUpdate(model); if (!results.Succeeded) { ViewData["Errors"] = results.Errors; return(PartialView("TransformMapDetailPartial", model)); } return(Json(new { isSuccess = true })); }
public IActionResult TransformMapDetailPartial(TransformationMapsVM model) { model.Products = transformMapService.GetProducts(); model.TransformationMap = transformMapService.Find(model.TransformationMapId); return(PartialView(model)); }