public async Task <string> CreatePost(PageSectionContentConditionCreateGet PageSectionContentCondition) { string usp = "usp_PageSectionContentConditionCreatePost @PageSectionId, @PageSectionContentConditionTypeId, @PageSectionContentConditionInt, @PageSectionContentConditionString, @PageSectionContentConditionDate, @Name, @Description, @MenuName, @MouseOver, @UserId "; var CheckString = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, PageSectionContentCondition); return(CheckString); }
public async Task <List <ErrorMessage> > CreatePostCheck(PageSectionContentConditionCreateGet PageSectionContentCondition) { string usp = "usp_PageSectionCreateConditionPostCheck @PageId, @Sequence, @PageSectionTypeId, @PageSectionDataTypeId, @@OneTwoColumns, @ContentTypeId, @SortById, @LanguageId, @Name, @CreatorId "; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, PageSectionContentCondition); return(ErrorMessages); }
public async Task <IActionResult> Create(PageSectionContentConditionCreateGet PageSectionContentCondition) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var PageSectionContentConditionCreateGetWithErrorMessage = await _client.PostProtectedAsync <PageSectionContentConditionCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/PageSectionContentCondition/Create", PageSectionContentCondition, token); if (PageSectionContentConditionCreateGetWithErrorMessage.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 = PageSectionContentConditionCreateGetWithErrorMessage.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/PageSectionContentCondition/Create", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = PageSectionContentConditionCreateGetWithErrorMessage.ErrorMessages; return(View(PageSectionContentConditionCreateGetWithErrorMessage.PageSectionContentCondition)); } return(RedirectToAction("Index", new { id = PageSectionContentCondition.PageSectionId })); }
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 PageSectionContentCondition = new PageSectionContentConditionCreateGet(); PageSectionContentCondition = await CreateAddDropDownBoxes(PageSectionContentCondition, CurrentUser.Id, Id); return(Ok(PageSectionContentCondition)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
private async Task <PageSectionContentConditionCreateGet> CreateAddDropDownBoxes(PageSectionContentConditionCreateGet PageSectionContentCondition, string UserId, int PageSectionId) { PageSectionContentCondition.PageSectionContentConditionTypes = await _pageSectionContentConditionTypeProvider.ListExtended(UserId); PageSectionContentCondition.Users = await _userProvider.List(); PageSectionContentCondition.Projects = await _projectProvider.List(UserId); PageSectionContentCondition.ContentTypes = await _contentTypeProvider.List(UserId); PageSectionContentCondition.ContentStatuses = await _contentStatusProvider.List(UserId); PageSectionContentCondition.Languages = await _languageProvider.List(UserId); PageSectionContentCondition.SecurityLevels = await _securityLevelProvider.List(UserId); PageSectionContentCondition.Classifications = await _pageSectionContentConditionProvider.CreateGetClassifications(UserId); for (int i = 0; i < PageSectionContentCondition.Classifications.Count(); i++) { PageSectionContentCondition.Classifications[i].ClassificationValues = await _pageSectionContentConditionProvider.CreateGetClassificationValues(UserId, PageSectionContentCondition.Classifications[i].ClassificationId); } PageSectionContentCondition.PageSectionId = PageSectionId; var SortBys = await _masterListProvider.SortByList(UserId); return(PageSectionContentCondition); }
public async Task <IActionResult> Create(PageSectionContentConditionCreateGet PageSectionContentCondition) { var CurrentUser = await _userManager.GetUserAsync(User); PageSectionContentCondition.UserId = CurrentUser.Id; //PETER TO DO add the below somehow. also in both updates //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 _classificationProvider.CreatePostCheck(Classification); // if (ErrorMessages.Count > 0) // { // Classification = await CreateAddDropDownBoxes(Classification, CurrentUser.Id); // } // else // { // _classificationProvider.CreatePost(Classification); // } // ClassificationCreateGetWithErrorMessages ClassificationWithErrorMessage = new ClassificationCreateGetWithErrorMessages { Classification = Classification, ErrorMessages = ErrorMessages }; // return Ok(ClassificationWithErrorMessage); //} //ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); //ClassificationCreateGetWithErrorMessages ClassificationWithNoRights = new ClassificationCreateGetWithErrorMessages { Classification = Classification, ErrorMessages = ErrorMessages }; //return Ok(ClassificationWithNoRights); if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString())) { PageSectionContentCondition.PageSectionContentConditionDate = DateTime.Now; if (PageSectionContentCondition.PageSectionContentConditionTypeIdExtended.Substring(0, 1) == "V") { PageSectionContentCondition.PageSectionContentConditionInt = PageSectionContentCondition.Classifications.Find(x => x.ClassificationId == int.Parse(PageSectionContentCondition.PageSectionContentConditionTypeIdExtended.Substring(1))).ClassificationValueId; PageSectionContentCondition.PageSectionContentConditionTypeId = 11; } else { PageSectionContentCondition.PageSectionContentConditionTypeId = int.Parse(PageSectionContentCondition.PageSectionContentConditionTypeIdExtended.Substring(1)); switch (PageSectionContentCondition.PageSectionContentConditionTypeIdExtended) { case "T1": PageSectionContentCondition.PageSectionContentConditionString = PageSectionContentCondition.UserId; break; case "T3": PageSectionContentCondition.PageSectionContentConditionInt = PageSectionContentCondition.OrganizationId; break; case "T4": PageSectionContentCondition.PageSectionContentConditionInt = PageSectionContentCondition.ProjectId; break; case "T5": PageSectionContentCondition.PageSectionContentConditionInt = PageSectionContentCondition.ContentTypeId; break; case "T6": PageSectionContentCondition.PageSectionContentConditionInt = PageSectionContentCondition.ContentStatusId; break; case "T7": PageSectionContentCondition.PageSectionContentConditionInt = PageSectionContentCondition.LanguageId; break; case "T8": PageSectionContentCondition.PageSectionContentConditionInt = PageSectionContentCondition.SecurityLevelId; break; case "T9": PageSectionContentCondition.PageSectionContentConditionString = PageSectionContentCondition.SelectedCreatorId; break; case "T10": PageSectionContentCondition.PageSectionContentConditionString = PageSectionContentCondition.SelectedModifierId; break; case "T12": PageSectionContentCondition.PageSectionContentConditionDate = PageSectionContentCondition.CreatedFromDate; break; case "T13": PageSectionContentCondition.PageSectionContentConditionDate = PageSectionContentCondition.CreatedToDate; break; case "T14": PageSectionContentCondition.PageSectionContentConditionDate = PageSectionContentCondition.ModifiedFromDate; break; case "T15": PageSectionContentCondition.PageSectionContentConditionDate = PageSectionContentCondition.ModifiedToDate; break; } } // var CheckString = await _pageSectionProvider.CreatePostCheck(PageSection); // if (CheckString.Length == 0) _pageSectionContentConditionProvider.CreatePost(PageSectionContentCondition); return(Ok(PageSectionContentCondition)); return(BadRequest(new { IsSuccess = false, // Message = CheckString, })); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }