public ActionResult CreateSolutionType(SolutionTypeViewModel solutionType) { if (ModelState.IsValid) { SolutionType newType = new SolutionType(); newType.Type = solutionType.Type.Trim(); newType.DateCreated = DateTime.Now; try { _solutionTypeService.CreateSolutionType(newType); _solutionTypeService.SaveSolutionType(); } catch (Exception ex) { return View(solutionType).WithError(ex.Message); } } else return View(solutionType).WithError("Invalid data"); return RedirectToAction("SolutionTypes").WithSuccess("Solution type" + solutionType.Type + " created successfully."); }
public void CreateSolutionType(SolutionType solutionType) { solutionsTypeRepository.Add(solutionType); }