public async Task <IActionResult> Update(ClassificationRelationTypeUpdateGet ClassificationRelationType)
        {
            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 _classificationRelationTypeProvider.UpdatePostCheck(ClassificationRelationType);

                if (ErrorMessages.Count > 0)
                {
                    ClassificationRelationType = await UpdateAddDropDownBoxes(ClassificationRelationType, CurrentUser.Id);
                }
                else
                {
                    _classificationRelationTypeProvider.UpdatePost(ClassificationRelationType);
                }
                ClassificationRelationTypeUpdateGetWithErrorMessages ClassificationRelationTypeWithErrorMessage = new ClassificationRelationTypeUpdateGetWithErrorMessages {
                    ClassificationRelationType = ClassificationRelationType, ErrorMessages = ErrorMessages
                };
                return(Ok(ClassificationRelationTypeWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ClassificationRelationTypeUpdateGetWithErrorMessages ClassificationRelationTypeWithNoRights = new ClassificationRelationTypeUpdateGetWithErrorMessages {
                ClassificationRelationType = ClassificationRelationType, ErrorMessages = ErrorMessages
            };

            return(Ok(ClassificationRelationTypeWithNoRights));
        }
Ejemplo n.º 2
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(ClassificationRelationTypeUpdateGet ClassificationRelationType)
        {
            string usp           = "usp_ClassificationRelationTypeUpdatePostCheck @ClassificationRelationTypeId, @Name, @Description, @MenuName, @MouseOver, @UserId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ClassificationRelationType);

            return(ErrorMessages);
        }
Ejemplo n.º 3
0
        public bool UpdatePost(ClassificationRelationTypeUpdateGet ClassificationRelationType)
        {
            string usp = "usp_ClassificationRelationTypeUpdatePost @ClassificationRelationTypeId, @Name, @Description, @MenuName, @MouseOver, @UserId";

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

            if (ClassificationRelationTypeUpdateGetWithErrorMessage.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 = ClassificationRelationTypeUpdateGetWithErrorMessage.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/ClassificationRelationType/Edit", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;
                //ViewBag.ErrorMessages = ClassificationRelationTypeUpdateGetWithErrorMessage.ErrorMessages;
                return(View(ClassificationRelationTypeUpdateGetWithErrorMessage.ClassificationRelationType));
            }

            return(RedirectToAction("Index"));
        }
 private async Task <ClassificationRelationTypeUpdateGet> UpdateAddDropDownBoxes(ClassificationRelationTypeUpdateGet ClassificationRelationType, string UserId)
 {
     //PETER At the moment not used as there is nothing to load on update
     return(ClassificationRelationType);
 }