public ActionResult AddNewDegree(AddDegreeViewModel newDegree) { if (ModelState.IsValid) { Degree degree = _mapper.Map <Degree>(newDegree); degree.DegreeIdentificator = _keyGenerator.GenerateNewId(); degree.DegreeIndexer = _keyGenerator.GenerateDegreeEntityIndexer(degree.Name); if (degree.Conditions.Count != 0) { degree.Conditions = newDegree.ConditionsList.Split(",").ToList(); } _context.degreeRepository.AddDegree(degree); #region EntityLogs var logInfoAddDegree = _logger.GenerateLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogTypeOfAction.TypesOfActions[0], LogDescriptions.DescriptionOfActionOnEntity["addDegree"]); _logger.AddDegreeLog(degree, logInfoAddDegree); #endregion #region PersonalUserLogs var logInfoPersonalAddDegree = _context.personalLogRepository.GeneratePersonalLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogDescriptions.DescriptionOfPersonalUserLog["addDegree"], "Indekser: " + degree.DegreeIndexer); _context.personalLogRepository.AddPersonalUserLogToAdminGroup(logInfoPersonalAddDegree); #endregion return(RedirectToAction("ConfirmationOfActionOnDegree", new { degreeIdentificator = degree.DegreeIdentificator, TypeOfAction = "Add" })); } newDegree.AvailableBranches = _context.branchRepository.GetBranchesAsSelectList().ToList(); if (newDegree.SelectedBranches == null) { newDegree.SelectedBranches = new List <string>(); } return(View(newDegree)); }