public bool UpdatePost(PersonUpdateGet Person) { string usp = "usp_PersonUpdatePost @PersonId , @Salutation, @FirstName, @MiddleName, @LastName, @PersonalTitle, @Suffix, @NickName, @FirstNameLocal, @MiddleNameLocal, @LastNameLocal, @GenderId, @Birthdate, @DeceasedDate, @DefaultOrganizationId, @UserId, @SelectedUserId"; _sqlDataAccess.SaveData <PersonUpdateGet>(usp, Person); return(true); }
public async Task <List <ErrorMessage> > UpdatePostCheck(PersonUpdateGet Person) { string usp = "usp_PersonUpdatePostCheck @PersonId , @Salutation, @FirstName, @MiddleName, @LastName, @PersonalTitle, @Suffix, @NickName, @FirstNameLocal, @MiddleNameLocal, @LastNameLocal, @GenderId, @Birthdate, @DeceasedDate, @DefaultOrganizationId, @UserId, @SelectedUserId"; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Person); return(ErrorMessages); }
public async Task <IActionResult> Update(PersonUpdateGet Person) { 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 _personProvider.UpdatePostCheck(Person); if (ErrorMessages.Count > 0) { Person = await UpdateAddDropDownBoxes(Person, CurrentUser.Id); } else { _personProvider.UpdatePost(Person); } PersonUpdateGetWithErrorMessages PersonWithErrorMessage = new PersonUpdateGetWithErrorMessages { Person = Person, ErrorMessages = ErrorMessages }; return(Ok(PersonWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); PersonUpdateGetWithErrorMessages PersonWithNoRights = new PersonUpdateGetWithErrorMessages { Person = Person, ErrorMessages = ErrorMessages }; return(Ok(PersonWithNoRights)); }
public async Task <IActionResult> Edit(PersonUpdateGet Person) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var PersonUpdateGetWithErrorMessage = await _client.PostProtectedAsync <PersonUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/Person/Update", Person, token); if (PersonUpdateGetWithErrorMessage.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 = PersonUpdateGetWithErrorMessage.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/Person/Edit", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = PersonUpdateGetWithErrorMessage.ErrorMessages; return(View(PersonUpdateGetWithErrorMessage.Person)); } return(RedirectToAction("Index")); }
private async Task <PersonUpdateGet> UpdateAddDropDownBoxes(PersonUpdateGet Person, string UserId) { var Gender = await _genderProvider.List(UserId); var Organization = await _organizationProvider.List(UserId); var Users = await _personProvider.EditGetUsers(Person.PersonId); Person.Genders = Gender; Person.Organizations = Organization; Person.Users = Users; return(Person); }