public async Task <IActionResult> Create(MetaContentCreateGet MetaContent) { var CurrentUser = await _userManager.GetUserAsync(User); MetaContent.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 _metaContentProvider.CreatePostCheck(MetaContent); if (ErrorMessages.Count > 0) { MetaContent = await CreateAddDropDownBoxes(MetaContent, CurrentUser.Id, MetaContent.MetaRecordId, MetaContent.MetaTypeId); } else { _metaContentProvider.CreatePost(MetaContent); } MetaContentCreateGetWithErrorMessages MetaContentWithErrorMessage = new MetaContentCreateGetWithErrorMessages { MetaContent = MetaContent, ErrorMessages = ErrorMessages }; return(Ok(MetaContentWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); MetaContentCreateGetWithErrorMessages MetaContentWithNoRights = new MetaContentCreateGetWithErrorMessages { MetaContent = MetaContent, ErrorMessages = ErrorMessages }; return(Ok(MetaContentWithNoRights)); }
public bool CreatePost(MetaContentCreateGet MetaContent) { string usp = "usp_MetaContentCreatePost @ContentId, @MetaContentTypeId, @MetaTypeId, @MetaRecordID, @UserID "; _sqlDataAccess.SaveData <MetaContentCreateGet>(usp, MetaContent); return(true); }
public async Task <List <ErrorMessage> > CreatePostCheck(MetaContentCreateGet MetaContent) { string usp = "usp_MetaContentCreatePostCheck @ContentId, @MetaContentTypeId, @MetaTypeId, @MetaRecordID, @UserID "; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, MetaContent); return(ErrorMessages); }
private async Task <MetaContentCreateGet> CreateAddDropDownBoxes(MetaContentCreateGet MetaContent, string UserId, int MetaTypeId, int MetaRecordId) { var TypeList = await _metaContentProvider.CreateGetMetaContentTypeList(UserId); MetaContent.MetaContentTypes = TypeList; var MetaContentCreateGetContentList = await _metaContentProvider.CreateGetContentList(UserId); var x = new Dictionary <string, string> { { "MetaTypeId", MetaTypeId.ToString() }, { "Id", MetaRecordId.ToString() } }; MetaContent.AllRouteData = x; MetaContent.Contents = MetaContentCreateGetContentList; return(MetaContent); }
public async Task <IActionResult> Create(int Id, [FromQuery(Name = "MetaTypeId")] int MetaTypeId) { 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 MetaContent = new MetaContentCreateGet(); MetaContent.MetaTypeId = MetaTypeId; MetaContent.MetaRecordId = Id; MetaContent = await CreateAddDropDownBoxes(MetaContent, CurrentUser.Id, Id, MetaTypeId); return(Ok(MetaContent)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }
public async Task <IActionResult> Create(MetaContentCreateGet MetaContent) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var MetaContentCreateGetWithErrorMessages = await _client.PostProtectedAsync <MetaContentCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/MetaContent/Create", MetaContent, token); if (MetaContentCreateGetWithErrorMessages.ErrorMessages.Count > 0) { ViewBag.AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, ""); //ViewBag.UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/MetaContent/Create", token); //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.ErrorMessages = MetaContentCreateGetWithErrorMessages.ErrorMessages; //ViewBag.Env = _hostingEnv.EnvironmentName; return(View(MetaContentCreateGetWithErrorMessages.MetaContent)); } return(RedirectToAction("Index", new { id = MetaContent.MetaRecordId, MetaTypeId = MetaContent.MetaTypeId })); }