public ActionResult AddNewMeeting(AddMeetingViewModel newMeeting) { if (ModelState.IsValid) { Meeting meeting = _mapper.Map <Meeting>(newMeeting); meeting.MeetingIdentificator = _keyGenerator.GenerateNewId(); var course = _context.courseRepository.GetCourseById(newMeeting.SelectedCourse); meeting.MeetingIndexer = _keyGenerator.GenerateMeetingEntityIndexer(course.CourseIndexer); _context.meetingRepository.AddMeeting(meeting); _context.courseRepository.AddMeetingToCourse(meeting.MeetingIdentificator, newMeeting.SelectedCourse); #region EntityLogs var logInfoAddMeeting = _logger.GenerateLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogTypeOfAction.TypesOfActions[0], LogDescriptions.DescriptionOfActionOnEntity["addMeeting"]); _logger.AddMeetingLog(meeting, logInfoAddMeeting); var updatedCourse = _context.courseRepository.GetCourseById(newMeeting.SelectedCourse); var logInfoUpdateCourse = _logger.GenerateLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogTypeOfAction.TypesOfActions[1], LogDescriptions.DescriptionOfActionOnEntity["addMeeting"]); _logger.AddCourseLog(updatedCourse, logInfoUpdateCourse); #endregion #region PersonalUserLogs var logInfoPersonalAddMeeting = _context.personalLogRepository.GeneratePersonalLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogDescriptions.DescriptionOfPersonalUserLog["addMeeting"], "Indekser: " + meeting.MeetingIndexer); _context.personalLogRepository.AddPersonalUserLogToAdminGroup(logInfoPersonalAddMeeting); var logInfoPersonalAddMeetingToCourse = _context.personalLogRepository.GeneratePersonalLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogDescriptions.DescriptionOfPersonalUserLog["addMeetingToCourse"], "Indekser: " + course.CourseIndexer); _context.personalLogRepository.AddPersonalUserLogToAdminGroup(logInfoPersonalAddMeetingToCourse); var logInfoPersonalAddInstructorsToMeeting = _context.personalLogRepository.GeneratePersonalLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogDescriptions.DescriptionOfPersonalUserLog["addInstructorToMeeting"], "Indekser: " + meeting.MeetingIndexer); _context.personalLogRepository.AddPersonalUsersLogs(meeting.Instructors, logInfoPersonalAddInstructorsToMeeting); #endregion return(RedirectToAction("ConfirmationOfActionOnMeeting", new { meetingIdentificator = meeting.MeetingIdentificator, TypeOfAction = "Add" })); } newMeeting.AvailableCourses = _context.courseRepository.GetActiveCoursesAsSelectList().ToList(); newMeeting.AvailableInstructors = _context.userRepository.GetInstructorsAsSelectList().ToList(); return(View(newMeeting)); }