public async Task <string> CreatePost(PersonRelationTypeCreateGet PersonRelationType)
        {
            string usp         = "usp_PersonRelationTypeCreatePost @Name, @Description , @MenuName, @MouseOver, @FromIsAnXOfTo, @ToIsAnXOfFrom, @SeePersonal, @Color, @IconId, @UserId";
            var    CheckString = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, PersonRelationType);

            return(CheckString);
        }
        public async Task <List <ErrorMessage> > CreatePostCheck(PersonRelationTypeCreateGet PersonRelationType)
        {
            string usp           = "usp_PersonRelationTypeCreatePostCheck @Name, @Description , @MenuName, @MouseOver, @FromIsAnXOfTo, @ToIsAnXOfFrom, @SeePersonal, @Color, @IconId, @UserId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, PersonRelationType);

            return(ErrorMessages);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(PersonRelationTypeCreateGet PersonRelationType)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var PersonRelationTypeCreateGetWithErrorMessage = await _client.PostProtectedAsync <PersonRelationTypeCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/PersonRelationType/Create", PersonRelationType, token);

            if (PersonRelationTypeCreateGetWithErrorMessage.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 = PersonRelationTypeCreateGetWithErrorMessage.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/PersonRelationType/Create", token);
                //ViewBag.Env = _hostingEnv.EnvironmentName;

                //ViewBag.ErrorMessages = PersonRelationTypeCreateGetWithErrorMessage.ErrorMessages;
                return(View(PersonRelationTypeCreateGetWithErrorMessage.PersonRelationType));
            }


            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Create(PersonRelationTypeCreateGet PersonRelationType)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            PersonRelationType.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 _personRelationTypeProvider.CreatePostCheck(PersonRelationType);

                if (ErrorMessages.Count > 0)
                {
                    PersonRelationType = await CreateAddDropDownBoxes(PersonRelationType, CurrentUser.Id);
                }
                else
                {
                    _personRelationTypeProvider.CreatePost(PersonRelationType);
                }
                PersonRelationTypeCreateGetWithErrorMessages PersonRelationTypeWithErrorMessage = new PersonRelationTypeCreateGetWithErrorMessages {
                    PersonRelationType = PersonRelationType, ErrorMessages = ErrorMessages
                };
                return(Ok(PersonRelationTypeWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            PersonRelationTypeCreateGetWithErrorMessages PersonRelationTypeWithNoRights = new PersonRelationTypeCreateGetWithErrorMessages {
                PersonRelationType = PersonRelationType, ErrorMessages = ErrorMessages
            };

            return(Ok(PersonRelationTypeWithNoRights));
        }
        private async Task <PersonRelationTypeCreateGet> CreateAddDropDownBoxes(PersonRelationTypeCreateGet PersonRelationType, string UserId)
        {
            var icons = await _masterListProvider.IconList(UserId);

            PersonRelationType.Icons = icons;
            return(PersonRelationType);
        }
        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 PersonRelationType = new PersonRelationTypeCreateGet();
                PersonRelationType = await CreateAddDropDownBoxes(PersonRelationType, CurrentUser.Id);

                return(Ok(PersonRelationType));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }