public async Task <IActionResult> Create(PropertyValueCreateGet PropertyValue) { var token = HttpContext.Session.GetString("Token"); if (token == null) { return(RedirectToAction("Login", "FrontAuth")); } var PropertyValueCreateGetWithErrorMessage = await _client.PostProtectedAsync <PropertyValueCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/PropertyValue/Create", PropertyValue, token); if (PropertyValueCreateGetWithErrorMessage.ErrorMessages.Count > 0) { 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/PropertyValue/Create", token); ViewBag.Env = _hostingEnv.EnvironmentName; ViewBag.ErrorMessages = PropertyValueCreateGetWithErrorMessage.ErrorMessages; return(View(PropertyValueCreateGetWithErrorMessage.PropertyValue)); } return(RedirectToAction("Index", new { id = PropertyValue.PropertyId })); }
public bool CreatePost(PropertyValueCreateGet PropertyValue) { string usp = "usp_PropertyValueCreatePost @PropertyId, @Sequence, @PropertyValueInt, @PropertyValueString, @PropertyValueBool, @PropertyValueDate, @Name , @Description , @MenuName , @MouseOver , @UserID"; _sqlDataAccess.SaveData <PropertyValueCreateGet>(usp, PropertyValue); return(true); }
public async Task <List <ErrorMessage> > CreatePostCheck(PropertyValueCreateGet PropertyValue) { string usp = "usp_PropertyCreatePostCheck @PropertyTypeId, @Name , @Description , @MenuName , @MouseOver , @CreatorId "; var ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, PropertyValue); return(ErrorMessages); }
public async Task <IActionResult> Create(PropertyValueCreateGet PropertyValue) { var CurrentUser = await _userManager.GetUserAsync(User); PropertyValue.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 _propertyValueProvider.CreatePostCheck(PropertyValue); if (ErrorMessages.Count > 0) { PropertyValue = await CreateAddDropDownBoxes(PropertyValue, CurrentUser.Id, PropertyValue.PropertyId); } else { _propertyValueProvider.CreatePost(PropertyValue); } PropertyValueCreateGetWithErrorMessages PropertyValueWithErrorMessage = new PropertyValueCreateGetWithErrorMessages { PropertyValue = PropertyValue, ErrorMessages = ErrorMessages }; return(Ok(PropertyValueWithErrorMessage)); } ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id); PropertyValueCreateGetWithErrorMessages PropertyValueWithNoRights = new PropertyValueCreateGetWithErrorMessages { PropertyValue = PropertyValue, ErrorMessages = ErrorMessages }; return(Ok(PropertyValueWithNoRights)); }
private async Task <PropertyValueCreateGet> CreateAddDropDownBoxes(PropertyValueCreateGet PropertyValue, string UserId, int PropertyId) { var PropertyValueCreateGetSequences = await _propertyValueProvider.CreateGetSequence(UserId, PropertyId); PropertyValueCreateGetSequences.Add(new SequenceList { Sequence = PropertyValueCreateGetSequences.Count + 1, Name = "Add at the end" }); PropertyValue.PropertyValues = PropertyValueCreateGetSequences; PropertyValue.PropertyId = PropertyId; PropertyValue.PropertyTypeId = await _propertyValueProvider.CreateGetType(UserId, PropertyId); return(PropertyValue); }
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 PropertyValue = new PropertyValueCreateGet(); PropertyValue = await CreateAddDropDownBoxes(PropertyValue, CurrentUser.Id, Id); return(Ok(PropertyValue)); } return(BadRequest(new { IsSuccess = false, Message = "No rights", })); }