public async Task <IActionResult> Update(OrganizationUpdateGet Organization) { 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 _organizationProvider.UpdatePostCheck(Organization); if (ErrorMessages.Count > 0) { Organization = await UpdateAddDropDownBoxes(Organization, CurrentUser.Id); } else { _organizationProvider.UpdatePost(Organization); } OrganizationUpdateGetWithErrorMessages OrganizationWithErrorMessage = new OrganizationUpdateGetWithErrorMessages { Organization = Organization, ErrorMessages = ErrorMessages }; return(Ok(OrganizationWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); OrganizationUpdateGetWithErrorMessages OrganizationWithNoRights = new OrganizationUpdateGetWithErrorMessages { Organization = Organization, ErrorMessages = ErrorMessages }; return(Ok(OrganizationWithNoRights)); }
public async Task <List <ErrorMessage> > UpdatePostCheck(OrganizationUpdateGet Organization) { string usp = "usp_OrganizationUpdatePostCheck @OrganizationId , @ParentOrganizationId, @StatusId, @OrganizationTypeID, @Name, @Description, @MenuName, @MouseOver, @ModifierId"; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Organization); return(ErrorMessages); }
public bool UpdatePost(OrganizationUpdateGet Organization) { string usp = "usp_OrganizationUpdatePost @OrganizationId , @ParentOrganizationId, @StatusId, @OrganizationTypeID, @Name, @Description, @MenuName, @MouseOver, @ModifierId"; _sqlDataAccess.SaveData <OrganizationUpdateGet>(usp, Organization); return(true); }
public async Task <IActionResult> Edit(OrganizationUpdateGet Organization) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var OrganizationUpdateGetWithErrorMessage = await _client.PostProtectedAsync <OrganizationUpdateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/Organization/Update", Organization, token); if (OrganizationUpdateGetWithErrorMessage.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 = OrganizationUpdateGetWithErrorMessage.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/Organization/Edit", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = OrganizationUpdateGetWithErrorMessage.ErrorMessages; return(View(OrganizationUpdateGetWithErrorMessage.Organization)); } return(RedirectToAction("Index")); }
private async Task <OrganizationUpdateGet> UpdateAddDropDownBoxes(OrganizationUpdateGet Organization, string UserId) { Organization.Statuses = await _masterListProvider.StatusList(UserId); Organization.OrganizationTypes = await _organizationTypeProvider.List(UserId); return(Organization); }