public async Task <string> CreatePost(PersonTelecomCreateGet PersonTelecom) { string usp = "usp_PersonTelecomCreatePost @PersonId , @TelecomTypeId , @TelecomValue, @CountryCode, @AreaCode, @ExtensionCode,@AskForName, @UserId "; var CheckString = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, PersonTelecom); return(CheckString); }
public async Task <IActionResult> Create(PersonTelecomCreateGet PersonTelecom) { var CurrentUser = await _userManager.GetUserAsync(User); PersonTelecom.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 _personTelecomProvider.CreatePostCheck(PersonTelecom); if (ErrorMessages.Count > 0) { PersonTelecom = await CreateAddDropDownBoxes(PersonTelecom, CurrentUser.Id, PersonTelecom.PersonId); } else { _personTelecomProvider.CreatePost(PersonTelecom); } PersonTelecomCreateGetWithErrorMessages PersonTelecomWithErrorMessage = new PersonTelecomCreateGetWithErrorMessages { PersonTelecom = PersonTelecom, ErrorMessages = ErrorMessages }; return(Ok(PersonTelecomWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); PersonTelecomCreateGetWithErrorMessages PersonTelecomWithNoRights = new PersonTelecomCreateGetWithErrorMessages { PersonTelecom = PersonTelecom, ErrorMessages = ErrorMessages }; return(Ok(PersonTelecomWithNoRights)); }
public async Task <List <ErrorMessage> > CreatePostCheck(PersonTelecomCreateGet PersonTelecom) { string usp = "usp_PersonTelecomCreatePostCheck @PersonId , @TelecomTypeId , @TelecomValue, @CountryCode, @AreaCode, @ExtensionCode,@AskForName, @UserId "; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, PersonTelecom); return(ErrorMessages); }
public async Task <IActionResult> Create(PersonTelecomCreateGet PersonTelecom) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var PersonTelecomCreateGetWithErrorMessage = await _client.PostProtectedAsync <PersonTelecomCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/PersonTelecom/Create", PersonTelecom, token); if (PersonTelecomCreateGetWithErrorMessage.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 = PersonTelecomCreateGetWithErrorMessage.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/PersonTelecom/Create", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = PersonTelecomCreateGetWithErrorMessage.ErrorMessages; return(View(PersonTelecomCreateGetWithErrorMessage.PersonTelecom)); } return(RedirectToAction("Index", new { id = PersonTelecom.PersonId })); }
public async Task <IActionResult> Create(PersonTelecomCreateGet PersonTelecom) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var PersonTelecomCreateGetWithErrorMessage = await _client.PostProtectedAsync <PersonTelecomCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/FrontPersonTelecom/Create", PersonTelecom, token); if (PersonTelecomCreateGetWithErrorMessage.ErrorMessages.Count > 0) { 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/FrontPersonTelecom/Create", token); ViewBag.Env = _hostingEnv.EnvironmentName; ViewBag.ErrorMessages = PersonTelecomCreateGetWithErrorMessage.ErrorMessages; return(View(PersonTelecomCreateGetWithErrorMessage.PersonTelecom)); } return(RedirectToAction("Index", new { id = PersonTelecom.PersonId })); }
private async Task <PersonTelecomCreateGet> CreateAddDropDownBoxes(PersonTelecomCreateGet PersonTelecom, string UserId, int PersonId) { var TelecomTypes = await _telecomTypeProvider.List(UserId); PersonTelecom.TelecomTypes = TelecomTypes; PersonTelecom.ConcatTelecomTypeId = "CONCAT11"; PersonTelecom.PersonId = PersonId; return(PersonTelecom); }
public async Task <IActionResult> Create(int Id) { 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 PersonTelecom = new PersonTelecomCreateGet(); return(Ok(PersonTelecom)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }