Пример #1
0
        public ActionResult EditGivenDegree(EditGivenDegreeViewModel editedGivenDegree)
        {
            if (ModelState.IsValid)
            {
                var originGivenDegree = _context.givenDegreeRepository.GetGivenDegreeById(editedGivenDegree.GivenDegreeIdentificator);

                originGivenDegree = _mapper.Map <EditGivenDegreeViewModel, GivenDegree>(editedGivenDegree, originGivenDegree);
                _context.givenDegreeRepository.UpdateGivenDegree(originGivenDegree);

                #region EntityLogs

                var logInfoUpdateGivenDegree = _logger.GenerateLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogTypeOfAction.TypesOfActions[1], LogDescriptions.DescriptionOfActionOnEntity["updateGivenDegree"]);
                _logger.AddGivenDegreeLog(originGivenDegree, logInfoUpdateGivenDegree);

                #endregion

                #region PersonalUserLogs

                var logInfoPersonalUpdateGivenDegree = _context.personalLogRepository.GeneratePersonalLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogDescriptions.DescriptionOfPersonalUserLog["updateGivenDegree"], "Indekser: " + originGivenDegree.GivenDegreeIndexer);
                _context.personalLogRepository.AddPersonalUserLogToAdminGroup(logInfoPersonalUpdateGivenDegree);

                var logInfoPersonalUpdateUserGivenDegree = _context.personalLogRepository.GeneratePersonalLogInformation(this.User.Identity.Name, this.ControllerContext.RouteData.Values["action"].ToString(), LogDescriptions.DescriptionOfPersonalUserLog["updateUserGivenDegree"], "Indekser: " + originGivenDegree.GivenDegreeIndexer);
                _context.personalLogRepository.AddPersonalUserLog(editedGivenDegree.User.UserIdentificator, logInfoPersonalUpdateUserGivenDegree);

                #endregion

                return(RedirectToAction("ConfirmationOfActionOnGivenDegree", "GivenDegrees", new { givenDegreeIdentificator = originGivenDegree.GivenDegreeIdentificator, TypeOfAction = "Update" }));
            }

            return(View(editedGivenDegree));
        }