コード例 #1
0
        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.");
        }
コード例 #2
0
 public void CreateSolutionType(SolutionType solutionType)
 {
     solutionsTypeRepository.Add(solutionType);
 }