public async Task <IActionResult> Create(ClassificationValueUserCreateGet ClassificationValueUser)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            ClassificationValueUser.UserId = CurrentUser.Id;
            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                //var CheckString = await _classificationValueUserProvider.CreatePostCheck(ClassificationValueUser);
                //if (CheckString.Length == 0)
                //{
                _classificationValueUserProvider.CreatePost(ClassificationValueUser);
                return(Ok(ClassificationValueUser));

                //}
                return(BadRequest(new
                {
                    IsSuccess = false,
                    //Message = CheckString,
                }));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
예제 #2
0
        public async Task <string> CreatePost(ClassificationValueUserCreateGet ClassificationValueUser)
        {
            string usp    = "usp_ClassificationValueUserCreatePost @UserOfClassificationValueId , @ClassificationValueId, @ClassificationRelationTypeId, @UserId";
            var    String = await _sqlDataAccess.LoadSingleRecord <string, dynamic>(usp, ClassificationValueUser);

            return(String);
        }
예제 #3
0
        public async Task <List <ErrorMessage> > CreatePostCheck(ClassificationValueUserCreateGet ClassificationValueUser)
        {
            string usp           = "usp_ClassificationValueUserCreatePostCheck @UserOfClassificationValueId, @ClassificationValueId, @ClassificationId , @ClassificationRelationTypeId, UserId";
            var    ErrorMessages = await _sqlDataAccess.LoadData <ErrorMessage, dynamic>(usp, ClassificationValueUser);

            return(ErrorMessages);
        }
예제 #4
0
        public async Task <IActionResult> Create(ClassificationValueUserCreateGet ClassificationValueUser)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var ClassificationValueUserCreateGetWithErrorMessage = await _client.PostProtectedAsync <ClassificationValueUserCreateGetWithErrorMessages>($"{_configuration["APIUrl"]}api/ClassificationValueUser/Create", ClassificationValueUser, token);

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

                //ViewBag.ErrorMessages = ClassificationValueUserCreateGetWithErrorMessage.ErrorMessages;
                return(View(ClassificationValueUserCreateGetWithErrorMessage.ClassificationValueUser));
            }

            return(RedirectToAction("Index", new { id = ClassificationValueUser.ClassificationValueId }));
        }
        private async Task <ClassificationValueUserCreateGet> CreateAddDropDownBoxes(ClassificationValueUserCreateGet ClassificationValueUser, string UserId, int ClassificationValueId)
        {
            var ClassificationRelationTypes = await _classificationRelationTypeProvider.List(UserId);

            ClassificationValueUser.ClassificationRelationTypes = ClassificationRelationTypes;
            var ClassificationValue = await _classificationValueRoleProvider.ClassificationValueRoleCreateGetClassificationName(UserId, ClassificationValueId);

            ClassificationValueUser.ClassificationId        = ClassificationValue.ClassificationId;
            ClassificationValueUser.ClassificationValueName = ClassificationValue.ClassificationValueName;
            ClassificationValueUser.Users = await _userProvider.List();

            ClassificationValueUser.ClassificationValueId = ClassificationValueId;
            return(ClassificationValueUser);
        }
        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 ClassificationValueUserCreateGet = new ClassificationValueUserCreateGet();
                return(Ok(ClassificationValueUserCreateGet));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }