public async Task <IActionResult> Create(FrontPersonCreateGet 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.CreatePostCheck(Person); if (ErrorMessages.Count > 0) { Person = await CreateAddDropDownBoxes(Person, CurrentUser.Id); } else { _frontPersonProvider.CreatePost(Person); } FrontPersonCreateGetWithErrorMessages PersonWithErrorMessage = new FrontPersonCreateGetWithErrorMessages { Person = Person, ErrorMessages = ErrorMessages }; return(Ok(PersonWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); FrontPersonCreateGetWithErrorMessages PersonWithNoRights = new FrontPersonCreateGetWithErrorMessages { Person = Person, ErrorMessages = ErrorMessages }; return(Ok(PersonWithNoRights)); }
public async Task <IActionResult> Create(FrontPersonCreateGet Person) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var FrontPersonCreateGetWithErrorMessage = await _client.PostProtectedAsync <FrontPersonCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/FrontPerson/Create", Person, token); if (FrontPersonCreateGetWithErrorMessage.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 = FrontPersonCreateGetWithErrorMessage.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/Create", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = FrontPersonCreateGetWithErrorMessage.ErrorMessages; return(View(FrontPersonCreateGetWithErrorMessage.Person)); } return(RedirectToAction("Index", "Front")); }
public async Task <string> CreatePost(FrontPersonCreateGet Person) { string usp = "usp_FrontPersonCreatePost @Salutation, @FirstName, @MiddleName, @LastName, @PersonalTitle, @Suffix, @NickName, @FirstNameLocal, @MiddleNameLocal, @LastNameLocal, @GenderId, @Birthdate, @DefaultOrganizationId, @UserId "; var CheckString = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, Person); return(CheckString); }
public async Task <List <ErrorMessage> > CreatePostCheck(FrontPersonCreateGet Person) { string usp = "usp_FrontPersonCreatePostCheck @Salutation, @FirstName, @MiddleName, @LastName, @PersonalTitle, @Suffix, @NickName, @FirstNameLocal, @MiddleNameLocal, @LastNameLocal, @GenderId, @Birthdate, @DefaultOrganizationId, @UserId "; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Person); return(ErrorMessages); }
private async Task <FrontPersonCreateGet> CreateAddDropDownBoxes(FrontPersonCreateGet Person, string UserId) { var Genders = await _genderProvider.List(UserId); var Organizations = await _organizationProvider.List(UserId); Person.Genders = Genders; Person.Organizations = Organizations; return(Person); }
public async Task <IActionResult> Create() { var CurrentUser = await _userManager.GetUserAsync(User); if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString())) { var Person = new FrontPersonCreateGet(); Person = await CreateAddDropDownBoxes(Person, CurrentUser.Id); return(Ok(Person)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }