public async Task <IActionResult> Edit(OrganizationTelecomUpdateGet OrganizationTelecom) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var OrganizationTelecomUpdateGetWithErrorMessage = await _client.PostProtectedAsync <OrganizationTelecomUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/FrontOrganizationTelecom/Update", OrganizationTelecom, token); if (OrganizationTelecomUpdateGetWithErrorMessage.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.Env = _hostingEnv.EnvironmentName; 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/FrontOrganizationTelecom/Edit", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = OrganizationTelecomUpdateGetWithErrorMessage.ErrorMessages; return(View(OrganizationTelecomUpdateGetWithErrorMessage.OrganizationTelecom)); } return(RedirectToAction("Dashboard", "FrontOrganization", new { id = OrganizationTelecom.OrganizationId })); }
public async Task <IActionResult> Update(OrganizationTelecomUpdateGet OrganizationTelecom) { var CurrentUser = await _userManager.GetUserAsync(User); OrganizationTelecom.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 _organizationTelecomProvider.UpdatePostCheck(OrganizationTelecom); if (ErrorMessages.Count > 0) { OrganizationTelecom = await UpdateAddDropDownBoxes(OrganizationTelecom, CurrentUser.Id); } else { _organizationTelecomProvider.UpdatePost(OrganizationTelecom); } OrganizationTelecomUpdateGetWithErrorMessages OrganizationTelecomWithErrorMessage = new OrganizationTelecomUpdateGetWithErrorMessages { OrganizationTelecom = OrganizationTelecom, ErrorMessages = ErrorMessages }; return(Ok(OrganizationTelecomWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); OrganizationTelecomUpdateGetWithErrorMessages OrganizationTelecomWithNoRights = new OrganizationTelecomUpdateGetWithErrorMessages { OrganizationTelecom = OrganizationTelecom, ErrorMessages = ErrorMessages }; return(Ok(OrganizationTelecomWithNoRights)); }
public async Task <IActionResult> Update(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())) { OrganizationTelecomUpdateGet OrganizationTelecom = await _organizationTelecomProvider.UpdateGet(CurrentUser.Id, Id); OrganizationTelecom = await UpdateAddDropDownBoxes(OrganizationTelecom, CurrentUser.Id); return(Ok(OrganizationTelecom)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
public bool UpdatePost(OrganizationTelecomUpdateGet OrganizationTelecom) { string usp = "usp_OrganizationTelecomUpdatePost @OrganizationTelecomId , @TelecomValue, @CountryCode, @AreaCode, @ExtensionCode,@AskForName, @UserId"; _sqlDataAccess.SaveData<OrganizationTelecomUpdateGet>(usp, OrganizationTelecom); return true; }
public async Task<List<ErrorMessage>> UpdatePostCheck(OrganizationTelecomUpdateGet OrganizationTelecom) { string usp = "usp_OrganizationTelecomUpdatePostCheck @OrganizationTelecomId , @TelecomValue, @CountryCode, @AreaCode, @ExtensionCode,@AskForName, @UserId"; var ErrorMessages = await _sqlDataAccess.LoadData<ErrorMessage, dynamic>(usp, OrganizationTelecom); return ErrorMessages; }
private async Task <OrganizationTelecomUpdateGet> UpdateAddDropDownBoxes(OrganizationTelecomUpdateGet OrganizationTelecom, string UserId) { //PETER this is empty and can probably be emty. return(OrganizationTelecom); }