コード例 #1
0
        public bool CreatePost(PropertyCreateGet Property)
        {
            string usp = "usp_PropertyCreatePost @PropertyTypeId, @Name , @Description , @MenuName , @MouseOver , @UserID";

            _sqlDataAccess.SaveData <PropertyCreateGet>(usp, Property);
            return(true);
        }
コード例 #2
0
        public async Task <List <ErrorMessage> > CreatePostCheck(PropertyCreateGet Property)
        {
            string usp           = "usp_PropertyCreatePostCheck @PropertyTypeId, @Name , @Description , @MenuName , @MouseOver , @CreatorId ";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, Property);

            return(ErrorMessages);
        }
コード例 #3
0
        public async Task <IActionResult> Create(PropertyCreateGet Property)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var PropertyCreateGetWithErrorMessage = await _client.PostProtectedAsync <PropertyCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/Property/Create", Property, token);

            if (PropertyCreateGetWithErrorMessage.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/Property/Create", token);

                ViewBag.Env = _hostingEnv.EnvironmentName;

                ViewBag.ErrorMessages = PropertyCreateGetWithErrorMessage.ErrorMessages;
                return(View(PropertyCreateGetWithErrorMessage.Property));
            }


            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public async Task <IActionResult> Create(PropertyCreateGet Property)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            Property.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 _propertyProvider.CreatePostCheck(Property);

                if (ErrorMessages.Count > 0)
                {
                    Property = await CreateAddDropDownBoxes(Property, CurrentUser.Id);
                }
                else
                {
                    _propertyProvider.CreatePost(Property);
                }
                PropertyCreateGetWithErrorMessages PropertyWithErrorMessage = new PropertyCreateGetWithErrorMessages {
                    Property = Property, ErrorMessages = ErrorMessages
                };
                return(Ok(PropertyWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            PropertyCreateGetWithErrorMessages PropertyWithNoRights = new PropertyCreateGetWithErrorMessages {
                Property = Property, ErrorMessages = ErrorMessages
            };

            return(Ok(PropertyWithNoRights));
        }
コード例 #5
0
        public async Task <IActionResult> Create()
        {
            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 Property = new PropertyCreateGet();
                Property = await CreateAddDropDownBoxes(Property, CurrentUser.Id);

                return(Ok(Property));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
コード例 #6
0
        private async Task <PropertyCreateGet> CreateAddDropDownBoxes(PropertyCreateGet Property, string UserId)
        {
            Property.PropertyTypes = await _propertyTypeProvider.List(UserId);

            return(Property);
        }