Ejemplo n.º 1
0
        public async Task <IActionResult> Update(FrontPersonUpdateGet Person)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            Person.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 _frontPersonProvider.UpdatePostCheck(Person);

                if (ErrorMessages.Count > 0)
                {
                    Person = await UpdateAddDropDownBoxes(Person, CurrentUser.Id);
                }
                else
                {
                    _frontPersonProvider.UpdatePost(Person);
                }
                FrontPersonUpdateGetWithErrorMessages FrontPersonWithErrorMessage = new FrontPersonUpdateGetWithErrorMessages {
                    Person = Person, ErrorMessages = ErrorMessages
                };
                return(Ok(FrontPersonWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            FrontPersonUpdateGetWithErrorMessages FrontPersonWithNoRights = new FrontPersonUpdateGetWithErrorMessages {
                Person = Person, ErrorMessages = ErrorMessages
            };

            return(Ok(FrontPersonWithNoRights));
        }
Ejemplo n.º 2
0
        public bool UpdatePost(FrontPersonUpdateGet Person)
        {
            string usp = "usp_FrontPersonUpdatePost @PersonId , @Salutation, @FirstName, @MiddleName, @LastName, @PersonalTitle, @Suffix, @NickName, @FirstNameLocal, @MiddleNameLocal, @LastNameLocal, @GenderId, @Birthdate, @DeceasedDate, @DefaultOrganizationId, @UserId ";

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

            if (FrontPersonUpdateGetWithErrorMessage.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 = FrontPersonUpdateGetWithErrorMessage.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/FrontPerson/Edit", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;

                //ViewBag.ErrorMessages = FrontPersonUpdateGetWithErrorMessage.ErrorMessages;
                return(View(FrontPersonUpdateGetWithErrorMessage.Person));
            }

            return(RedirectToAction("Index", "Front"));
        }
Ejemplo n.º 4
0
        public async Task <List <ErrorMessage> > UpdatePostCheck(FrontPersonUpdateGet Person)
        {
            string usp           = "usp_FrontPersonUpdatePostCheck @PersonId , @Salutation, @FirstName, @MiddleName, @LastName, @PersonalTitle, @Suffix, @NickName, @FirstNameLocal, @MiddleNameLocal, @LastNameLocal, @GenderId, @Birthdate, @DeceasedDate, @DefaultOrganizationId, @UserId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Person);

            return(ErrorMessages);
        }
Ejemplo n.º 5
0
        private async Task <FrontPersonUpdateGet> UpdateAddDropDownBoxes(FrontPersonUpdateGet Person, string UserId)
        {
            var Gender = await _genderProvider.List(UserId);

            var Organization = await _organizationProvider.List(UserId);

            Person.Genders       = Gender;
            Person.Organizations = Organization;
            return(Person);
        }