public async Task <IActionResult> Create(ObjectTypePropertyCreateGet ContentTypeProperty) { var CurrentUser = await _userManager.GetUserAsync(User); ContentTypeProperty.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 _contentTypePropertyProvider.CreatePostCheck(ContentTypeProperty); if (ErrorMessages.Count > 0) { ContentTypeProperty = await CreateAddDropDownBoxes(ContentTypeProperty, CurrentUser.Id); } else { _contentTypePropertyProvider.CreatePost(ContentTypeProperty); } ObjectTypePropertyCreateGetWithErrorMessages ContentTypePropertyWithErrorMessage = new ObjectTypePropertyCreateGetWithErrorMessages { ObjectTypeProperty = ContentTypeProperty, ErrorMessages = ErrorMessages }; return(Ok(ContentTypePropertyWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); ObjectTypePropertyCreateGetWithErrorMessages ContentTypePropertyWithNoRights = new ObjectTypePropertyCreateGetWithErrorMessages { ObjectTypeProperty = ContentTypeProperty, ErrorMessages = ErrorMessages }; return(Ok(ContentTypePropertyWithNoRights)); }
public async Task <IActionResult> Create(ObjectTypePropertyCreateGet ProjectTypeProperty) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var ProjectTypePropertyCreateGetWithErrorMessage = await _client.PostProtectedAsync <ObjectTypePropertyCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ProjectTypeProperty/Create", ProjectTypeProperty, token); if (ProjectTypePropertyCreateGetWithErrorMessage.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 = ProjectTypePropertyCreateGetWithErrorMessage.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/ProjectTypeProperty/Create", token); //ViewBag.Env = _hostingEnv.EnvironmentName; //ViewBag.ErrorMessages = ProjectTypePropertyCreateGetWithErrorMessage.ErrorMessages; return(View(ProjectTypePropertyCreateGetWithErrorMessage.ObjectTypeProperty)); } return(RedirectToAction("Index", new { id = ProjectTypeProperty.ObjectTypeId })); }
public async Task <string> CreatePost(ObjectTypePropertyCreateGet PersonTypeProperty) { string usp = "usp_PersonTypePropertyCreatePost @ObjectTypeId, @PropertyId , @ObjectTypePropertyStatusId, @UserId "; var String = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, PersonTypeProperty); return(String); }
public async Task <List <ErrorMessage> > CreatePostCheck(ObjectTypePropertyCreateGet PersonTypeProperty) { string usp = "usp_PersonTypePropertyCreatePostCheck @ObjectTypeId, @PropertyId , @ObjectTypePropertyStatusId, @UserId "; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, PersonTypeProperty); return(ErrorMessages); }
private async Task <ObjectTypePropertyCreateGet> CreateAddDropDownBoxes(ObjectTypePropertyCreateGet ContentTypeProperty, string UserId) { ContentTypeProperty.Statuses = await _objectTypePropertyStatus.List(UserId); ContentTypeProperty.Properties = await _propertyProvider.List(UserId); ContentTypeProperty.ObjectTypeName = await _contentTypeProvider.ReturnName(UserId, ContentTypeProperty.ObjectTypeId); return(ContentTypeProperty); }
private async Task <ObjectTypePropertyCreateGet> CreateAddDropDownBoxes(ObjectTypePropertyCreateGet OrganizationTypeProperty, string UserId) { OrganizationTypeProperty.Statuses = await _objectTypePropertyStatus.List(UserId); OrganizationTypeProperty.Properties = await _propertyProvider.List(UserId); OrganizationTypeProperty.ObjectTypeName = await _organizationTypeProvider.ReturnName(UserId, OrganizationTypeProperty.ObjectTypeId); return(OrganizationTypeProperty); }
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 ContentTypeProperty = new ObjectTypePropertyCreateGet(); ContentTypeProperty.ObjectTypeId = Id; ContentTypeProperty = await CreateAddDropDownBoxes(ContentTypeProperty, CurrentUser.Id); return(Ok(ContentTypeProperty)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }