public bool UpdatePost(PersonRelationUpdateGet PersonRelation)
        {
            string usp = "usp_PersonRelationUpdatePost @PersonRelationId ,  @FromPersonId, @ToPersonId, @ValidFrom, @ValidTill, @PersonRelationTypeId, @ModifierId";

            _sqlDataAccess.SaveData <PersonRelationUpdateGet>(usp, PersonRelation);
            return(true);
        }
        public async Task <List <ErrorMessage> > UpdatePostCheck(PersonRelationUpdateGet PersonRelation)
        {
            string usp           = "usp_PersonRelationUpdatePostCheck @FromPersonId, @ToPersonId, @ValidFrom, @ValidTill, @PersonRelationTypeId, @CreatorId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, PersonRelation);

            return(ErrorMessages);
        }
        public async Task <IActionResult> Update(PersonRelationUpdateGet PersonRelation)
        {
            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 _personRelationProvider.UpdatePostCheck(PersonRelation);

                if (ErrorMessages.Count > 0)
                {
                    PersonRelation = await UpdateAddDropDownBoxes(PersonRelation, CurrentUser.Id);
                }
                else
                {
                    _personRelationProvider.UpdatePost(PersonRelation);
                }
                PersonRelationUpdateGetWithErrorMessages PersonRelationWithErrorMessage = new PersonRelationUpdateGetWithErrorMessages {
                    PersonRelation = PersonRelation, ErrorMessages = ErrorMessages
                };
                return(Ok(PersonRelationWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            PersonRelationUpdateGetWithErrorMessages PersonRelationWithNoRights = new PersonRelationUpdateGetWithErrorMessages {
                PersonRelation = PersonRelation, ErrorMessages = ErrorMessages
            };

            return(Ok(PersonRelationWithNoRights));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(PersonRelationUpdateGet PersonRelation)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var PersonRelationUpdateGetWithErrorMessage = await _client.PostProtectedAsync <PersonRelationUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/PersonRelation/Update", PersonRelation, token);

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

                //ViewBag.ErrorMessages = PersonRelationUpdateGetWithErrorMessage.ErrorMessages;
                return(View(PersonRelationUpdateGetWithErrorMessage.PersonRelation));
            }

            return(RedirectToAction("Index", new { id = PersonRelation.FromPersonId }));
        }
 private async Task <PersonRelationUpdateGet> UpdateAddDropDownBoxes(PersonRelationUpdateGet PersonRelation, string UserId)
 {
     return(PersonRelation);
 }