Exemple #1
0
        public async Task <IActionResult> Update(ClassificationUpdateGet Classification)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            Classification.UserId = CurrentUser.Id;
            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 _classificationProvider.UpdatePostCheck(Classification);

                if (ErrorMessages.Count > 0)
                {
                    Classification = await UpdateAddDropDownBoxes(Classification, CurrentUser.Id);
                }
                else
                {
                    await _classificationProvider.UpdatePost(Classification);
                }
                ClassificationUpdateGetWithErrorMessages ClassificationWithErrorMessage = new ClassificationUpdateGetWithErrorMessages {
                    Classification = Classification, ErrorMessages = ErrorMessages
                };
                return(Ok(ClassificationWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ClassificationUpdateGetWithErrorMessages ClassificationWithNoRights = new ClassificationUpdateGetWithErrorMessages {
                Classification = Classification, ErrorMessages = ErrorMessages
            };

            return(Ok(ClassificationWithNoRights));
        }
Exemple #2
0
        public async Task <IActionResult> Update(ClassificationUpdateGet Classification)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                Classification.UserId = CurrentUser.Id;
                //var CheckString = await _classificationProvider.UpdatePostCheck(Classification);
                //if (CheckString.Length == 0)
                //{
                _classificationProvider.UpdatePost(Classification);
                return(Ok(Classification));

                //}
                return(BadRequest(new
                {
                    IsSuccess = false,
                    //Message = CheckString,
                }));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
        public async Task <bool> UpdatePost(ClassificationUpdateGet Classification)
        {
            string usp = "usp_ClassificationUpdatePost @classificationId, @StatusId , @DefaultPageId , @HasDropDown , @DropDownSequence , @Name , @Description , @MenuName , @MouseOver ,@Color, @IconId, @UserId ";
            await _sqlDataAccess.SaveData <ClassificationUpdateGet>(usp, Classification);

            return(true);
        } //PETER TODO In the stored procedure the check on hasdropdown is not yet ok.
        public async Task <List <ErrorMessage> > UpdatePostCheck(ClassificationUpdateGet Classification)
        {
            string usp           = "usp_ClassificationUpdatePostCheck @classificationId, @StatusId , @DefaultPageId , @HasDropDown , @DropDownSequence , @Name , @Description , @MenuName , @MouseOver , @UserId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Classification);

            return(ErrorMessages);
        }
Exemple #5
0
        public async Task <IActionResult> Edit(ClassificationUpdateGet Classification)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            await _client.PostProtectedAsync <ClassificationUpdateGet>($"{_configuration["APIUrl"]}api/Classification/Update", Classification, token);

            return(RedirectToAction("Index"));
        }
Exemple #6
0
        private async Task <ClassificationUpdateGet> UpdateAddDropDownBoxes(ClassificationUpdateGet Classification, string UserId)
        {
            Classification = await _classificationProvider.UpdateGet(UserId, Classification.ClassificationId);

            var Sequences = await _classificationProvider.CreateGetSequence(UserId);

            var Statuses = await _masterListProvider.StatusList(UserId);

            var icons = await _masterListProvider.IconList(UserId);

            Classification.Icons = icons;

            Classification.DropDownSequences = Sequences;
            //  Classification.DefaultPages = Pages;
            Classification.Statuses = Statuses;
            return(Classification);
        }
Exemple #7
0
        public async Task <IActionResult> Edit(ClassificationUpdateGet Classification)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ClassificationUpdateGetWithErrorMessage = await _client.PostProtectedAsync <ClassificationUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/Classification/Update", Classification, token);

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


                //ViewBag.UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/Classification/Edit", token);
                //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.ErrorMessages = ClassificationUpdateGetWithErrorMessage.ErrorMessages;
                //ViewBag.Env = _hostingEnv.EnvironmentName;
                return(View(ClassificationUpdateGetWithErrorMessage.Classification));
            }
            return(RedirectToAction("Index"));
        }