public async Task <IActionResult> Update(ClassificationValueUserUpdateGet ClassificationValueUser)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var ErrorMessages = new List <ErrorMessage>();

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                ErrorMessages = await _classificationValueUserProvider.UpdatePostCheck(ClassificationValueUser);

                if (ErrorMessages.Count > 0)
                {
                    ClassificationValueUser = await UpdateAddDropDownBoxes(ClassificationValueUser, CurrentUser.Id, ClassificationValueUser.ClassificationValueId);
                }
                else
                {
                    _classificationValueUserProvider.UpdatePost(ClassificationValueUser);
                }
                ClassificationValueUserUpdateGetWithErrorMessages ClassificationValueUserWithErrorMessage = new ClassificationValueUserUpdateGetWithErrorMessages {
                    ClassificationValueUser = ClassificationValueUser, ErrorMessages = ErrorMessages
                };
                return(Ok(ClassificationValueUserWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ClassificationValueUserUpdateGetWithErrorMessages ClassificationValueUserWithNoRights = new ClassificationValueUserUpdateGetWithErrorMessages {
                ClassificationValueUser = ClassificationValueUser, ErrorMessages = ErrorMessages
            };

            return(Ok(ClassificationValueUserWithNoRights));
        }
Ejemplo n.º 2
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(ClassificationValueUserUpdateGet ClassificationValueUser)
        {
            string usp           = "usp_ClassificationValueUserUpdatePostCheck @ClassificationValueUserId, @UserOfClassificationValueId, @ClassificationRelationTypeId, @UserId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ClassificationValueUser);

            return(ErrorMessages);
        }
Ejemplo n.º 3
0
        public bool UpdatePost(ClassificationValueUserUpdateGet ClassificationValueUser)
        {
            string usp = "usp_ClassificationValueUserUpdatePost @ClassificationValueUserId, @UserOfClassificationValueId, @ClassificationRelationTypeId, @UserId";

            _sqlDataAccess.SaveData <ClassificationValueUserUpdateGet>(usp, ClassificationValueUser);
            return(true);
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Edit(ClassificationValueUserUpdateGet ClassificationValueUser)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ClassificationValueUserUpdateGetWithErrorMessage = await _client.PostProtectedAsync <ClassificationValueUserUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ClassificationValueUser/Update", ClassificationValueUser, token);

            if (ClassificationValueUserUpdateGetWithErrorMessage.ErrorMessages.Count > 0)
            {
                var AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, "");

                AllStuff.ErrorMessages = ClassificationValueUserUpdateGetWithErrorMessage.ErrorMessages;
                ViewBag.AllStuff       = AllStuff;
                //ViewBag.Favorites = await _client.GetProtectedAsync<List<MVCFavoriteMenu>>($"{_configuration["APIUrl"]}api/MVCFavorite/Menu", token);
                //ViewBag.FavoriteGroupList = await _client.GetProtectedAsync<List<MVCFavoriteGroupList>>($"{_configuration["APIUrl"]}api/MVCFavorite/GroupList", token);
                //ViewBag.UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/ClassificationValueUser/Edit", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;

                //ViewBag.ErrorMessages = ClassificationValueUserUpdateGetWithErrorMessage.ErrorMessages;
                return(View(ClassificationValueUserUpdateGetWithErrorMessage.ClassificationValueUser));
            }

            return(RedirectToAction("Index", new { id = ClassificationValueUser.ClassificationValueId }));
        }
        private async Task <ClassificationValueUserUpdateGet> UpdateAddDropDownBoxes(ClassificationValueUserUpdateGet ClassificationValueUser, string UserId, int ClassificationValueId)
        {
            var RelationTypeList = await _classificationRelationTypeProvider.List(UserId);

            var UserList = await _userProvider.List();

            ClassificationValueUser.ClassificationRelationTypes = RelationTypeList;
            ClassificationValueUser.Users = UserList;
            return(ClassificationValueUser);
        }