コード例 #1
0
        public async Task <IActionResult> Create(PersonAddressCreateGet PersonAddress)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            PersonAddress.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 _personAddressProvider.CreatePostCheck(PersonAddress);

                if (ErrorMessages.Count > 0)
                {
                    PersonAddress = await CreateAddDropDownBoxes(PersonAddress, CurrentUser.Id, PersonAddress.PersonId);
                }
                else
                {
                    _personAddressProvider.CreatePost(PersonAddress);
                }
                PersonAddressCreateGetWithErrorMessages PersonAddressWithErrorMessage = new PersonAddressCreateGetWithErrorMessages {
                    PersonAddress = PersonAddress, ErrorMessages = ErrorMessages
                };
                return(Ok(PersonAddressWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            PersonAddressCreateGetWithErrorMessages PersonAddressWithNoRights = new PersonAddressCreateGetWithErrorMessages {
                PersonAddress = PersonAddress, ErrorMessages = ErrorMessages
            };

            return(Ok(PersonAddressWithNoRights));
        }
コード例 #2
0
        public async Task <IActionResult> Create(OrganizationCreateGet Organization)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            Organization.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 _organizationProvider.CreatePostCheck(Organization);

                if (ErrorMessages.Count > 0)
                {
                    Organization = await CreateAddDropDownBoxes(Organization, CurrentUser.Id);
                }
                else
                {
                    _organizationProvider.CreatePost(Organization);
                }
                OrganizationCreateGetWithErrorMessages OrganizationWithErrorMessage = new OrganizationCreateGetWithErrorMessages {
                    Organization = Organization, ErrorMessages = ErrorMessages
                };
                return(Ok(OrganizationWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            OrganizationCreateGetWithErrorMessages OrganizationWithNoRights = new OrganizationCreateGetWithErrorMessages {
                Organization = Organization, ErrorMessages = ErrorMessages
            };

            return(Ok(OrganizationWithNoRights));
        }
コード例 #3
0
        public async Task <IActionResult> Create(ClassificationValueCreateGet ClassificationValue)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            ClassificationValue.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 _classificationValueProvider.CreatePostCheck(ClassificationValue);

                if (ErrorMessages.Count > 0)
                {
                    ClassificationValue = await CreateAddDropDownBoxes(ClassificationValue, CurrentUser.Id, ClassificationValue.ClassificationId, ClassificationValue.ParentId ?? 0);
                }
                else
                {
                    _classificationValueProvider.CreatePost(ClassificationValue);
                }
                ClassificationValueCreateGetWithErrorMessages ClassificationValueWithErrorMessage = new ClassificationValueCreateGetWithErrorMessages {
                    ClassificationValue = ClassificationValue, ErrorMessages = ErrorMessages
                };
                return(Ok(ClassificationValueWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ClassificationValueCreateGetWithErrorMessages ClassificationValueWithNoRights = new ClassificationValueCreateGetWithErrorMessages {
                ClassificationValue = ClassificationValue, ErrorMessages = ErrorMessages
            };

            return(Ok(ClassificationValueWithNoRights));
        }
コード例 #4
0
        public async Task <IActionResult> Create(ProjectMatrixTypeCreateGet ProjectMatrixType)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            ProjectMatrixType.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 _projectMatrixTypeProvider.CreatePostCheck(ProjectMatrixType);

                if (ErrorMessages.Count > 0)
                {
                }
                else
                {
                    _projectMatrixTypeProvider.CreatePost(ProjectMatrixType);
                }
                ProjectMatrixTypeCreateGetWithErrorMessages ProjectMatrixTypeWithErrorMessage = new ProjectMatrixTypeCreateGetWithErrorMessages {
                    ProjectMatrixType = ProjectMatrixType, ErrorMessages = ErrorMessages
                };
                return(Ok(ProjectMatrixTypeWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ProjectMatrixTypeCreateGetWithErrorMessages ProjectMatrixTypeWithNoRights = new ProjectMatrixTypeCreateGetWithErrorMessages {
                ProjectMatrixType = ProjectMatrixType, ErrorMessages = ErrorMessages
            };

            return(Ok(ProjectMatrixTypeWithNoRights));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        public async Task <IActionResult> Create(UserMenuTemplateCreateGet UserMenuTemplate)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            UserMenuTemplate.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 _userMenuTemplateProvider.CreatePostCheck(UserMenuTemplate);

                if (ErrorMessages.Count > 0)
                {
                    UserMenuTemplate = await CreateAddDropDownBoxes(UserMenuTemplate, CurrentUser.Id);
                }
                else
                {
                    _userMenuTemplateProvider.CreatePost(UserMenuTemplate);
                }
                UserMenuTemplateCreateGetWithErrorMessages UserMenuTemplateWithErrorMessage = new UserMenuTemplateCreateGetWithErrorMessages {
                    UserMenuTemplate = UserMenuTemplate, ErrorMessages = ErrorMessages
                };
                return(Ok(UserMenuTemplateWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            UserMenuTemplateCreateGetWithErrorMessages UserMenuTemplateWithNoRights = new UserMenuTemplateCreateGetWithErrorMessages {
                UserMenuTemplate = UserMenuTemplate, ErrorMessages = ErrorMessages
            };

            return(Ok(UserMenuTemplateWithNoRights));
        }
コード例 #7
0
        public async Task <IActionResult> Create(RoleGroupCreateGet RoleGroup)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            RoleGroup.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 _roleGroupProvider.CreatePostCheck(RoleGroup);

                if (ErrorMessages.Count > 0)
                {
                    RoleGroup = await CreateAddDropDownBoxes(RoleGroup, CurrentUser.Id);
                }
                else
                {
                    _roleGroupProvider.CreatePost(RoleGroup);
                }
                RoleGroupCreateGetWithErrorMessages RoleGroupWithErrorMessage = new RoleGroupCreateGetWithErrorMessages {
                    RoleGroup = RoleGroup, ErrorMessages = ErrorMessages
                };
                return(Ok(RoleGroupWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            RoleGroupCreateGetWithErrorMessages RoleGroupWithNoRights = new RoleGroupCreateGetWithErrorMessages {
                RoleGroup = RoleGroup, ErrorMessages = ErrorMessages
            };

            return(Ok(RoleGroupWithNoRights));
        }
コード例 #8
0
        public async Task <IActionResult> RightsUpdate(FrontContentRightsUpdateGet FrontContentRights)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            FrontContentRights.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 _frontContentProvider.RightsUpdatePostCheck(FrontContentRights);

                if (ErrorMessages.Count == 0)
                {
                    _frontContentProvider.RightsUpdatePost(FrontContentRights);
                }
                FrontContentRightsUpdateGetWithErrorMessages FrontContentRightsUpdateGetWithErrorMessage = new FrontContentRightsUpdateGetWithErrorMessages {
                    FrontContentRights = FrontContentRights, ErrorMessages = ErrorMessages
                };
                return(Ok(FrontContentRightsUpdateGetWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            FrontContentRightsUpdateGetWithErrorMessages FrontContentRightsUpdateGetWithNoRights = new FrontContentRightsUpdateGetWithErrorMessages {
                FrontContentRights = FrontContentRights, ErrorMessages = ErrorMessages
            };

            return(Ok(FrontContentRightsUpdateGetWithNoRights));
        }
コード例 #9
0
        public async Task <IActionResult> Create(MetaContentCreateGet MetaContent)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            MetaContent.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 _metaContentProvider.CreatePostCheck(MetaContent);

                if (ErrorMessages.Count > 0)
                {
                    MetaContent = await CreateAddDropDownBoxes(MetaContent, CurrentUser.Id, MetaContent.MetaRecordId, MetaContent.MetaTypeId);
                }
                else
                {
                    _metaContentProvider.CreatePost(MetaContent);
                }
                MetaContentCreateGetWithErrorMessages MetaContentWithErrorMessage = new MetaContentCreateGetWithErrorMessages {
                    MetaContent = MetaContent, ErrorMessages = ErrorMessages
                };
                return(Ok(MetaContentWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            MetaContentCreateGetWithErrorMessages MetaContentWithNoRights = new MetaContentCreateGetWithErrorMessages {
                MetaContent = MetaContent, ErrorMessages = ErrorMessages
            };

            return(Ok(MetaContentWithNoRights));
        }
コード例 #10
0
        public async Task <IActionResult> Update(ProjectUpdateGet Project)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            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 _projectProvider.UpdatePostCheck(Project);

                if (ErrorMessages.Count > 0)
                {
                    Project = await UpdateAddDropDownBoxes(Project, CurrentUser.Id);
                }
                else
                {
                    _projectProvider.UpdatePost(Project);
                }
                ProjectUpdateGetWithErrorMessages ProjectWithErrorMessage = new ProjectUpdateGetWithErrorMessages {
                    Project = Project, ErrorMessages = ErrorMessages
                };
                return(Ok(ProjectWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            ProjectUpdateGetWithErrorMessages ProjectWithNoRights = new ProjectUpdateGetWithErrorMessages {
                Project = Project, ErrorMessages = ErrorMessages
            };

            return(Ok(ProjectWithNoRights));
        }
コード例 #11
0
        public async Task <IActionResult> Update(MVCFavoriteUpdateGet MVCFavorite)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            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 _frontUserFavoriteProvider.UpdatePostCheck(MVCFavorite);

                if (ErrorMessages.Count > 0)
                {
                    MVCFavorite = await UpdateAddDropDownBoxes(MVCFavorite, CurrentUser.Id);
                }
                else
                {
                    _frontUserFavoriteProvider.UpdatePost(MVCFavorite);
                }
                MVCFavoriteUpdateGetWithErrorMessages MVCFavoriteWithErrorMessage = new MVCFavoriteUpdateGetWithErrorMessages {
                    MVCFavorite = MVCFavorite, ErrorMessages = ErrorMessages
                };
                return(Ok(MVCFavoriteWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            MVCFavoriteUpdateGetWithErrorMessages MVCFavoriteWithNoRights = new MVCFavoriteUpdateGetWithErrorMessages {
                MVCFavorite = MVCFavorite, ErrorMessages = ErrorMessages
            };

            return(Ok(MVCFavoriteWithNoRights));
        }
コード例 #12
0
ファイル: BaseController.cs プロジェクト: peterlegrand/SIPx
        public async Task <IActionResult> LanguageCreate(BaseLanguageCreateGet BaseLanguage)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            BaseLanguage.UserId = CurrentUser.Id;
            var ErrorMessages = new List <ErrorMessage>();

            if (await _claimCheck.CheckClaim(
                    CurrentUser
                    , "ApplicationRight"
                    , BaseLanguage.BaseType + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                ErrorMessages = await _baseProvider.CreatePostCheck(BaseLanguage);

                if (ErrorMessages.Count > 0)
                {
                    BaseLanguage = await CreateAddDropDownBoxes(BaseLanguage, CurrentUser.Id);
                }
                else
                {
                    _baseProvider.CreatePost(BaseLanguage);
                }
                BaseLanguageCreateGetWithErrorMessages BaseLanguageWithErrorMessage
                    = new BaseLanguageCreateGetWithErrorMessages {
                    BaseLanguage = BaseLanguage, ErrorMessages = ErrorMessages
                    };
                return(Ok(BaseLanguageWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            BaseLanguageCreateGetWithErrorMessages BaseLanguageWithNoRights = new BaseLanguageCreateGetWithErrorMessages {
                BaseLanguage = BaseLanguage, ErrorMessages = ErrorMessages
            };

            return(Ok(BaseLanguageWithNoRights));
        }
コード例 #13
0
ファイル: UserController.cs プロジェクト: peterlegrand/SIPx
        public async Task <IActionResult> Create(UserCreateGet CreateUser)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            CreateUser.ModifierCreator = 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 _userProvider.CreatePostCheck(CreateUser);

                if (ErrorMessages.Count > 0)
                {
                    CreateUser = await CreateAddDropDownBoxes(CreateUser, CurrentUser.Id);
                }
                else
                {
                    var identityUser = new SipUser
                    {
                        Email    = CreateUser.Email,
                        UserName = CreateUser.Email,
                        //    FirstName = "Peter",
                        //    LastName = "le Grand",
                        //    LanguageId = 41,
                        SecurityLevelId = CreateUser.SecurityLevelId,
                        CreatedDate     = DateTime.Now,
                        ModifiedDate    = DateTime.Now
                    };
                    var x = await _userManager.CreateAsync(identityUser, CreateUser.Password);

                    if (x.Succeeded)
                    {
                        _userProvider.CreatePost(CreateUser);
                    }
                }
                UserCreateGetWithErrorMessages UserWithErrorMessage = new UserCreateGetWithErrorMessages {
                    User = CreateUser, ErrorMessages = ErrorMessages
                };
                return(Ok(UserWithErrorMessage));
            }
            ErrorMessages = await _checkProvider.NoRightsMessage(CurrentUser.Id);

            UserCreateGetWithErrorMessages UserWithNoRights = new UserCreateGetWithErrorMessages {
                User = CreateUser, ErrorMessages = ErrorMessages
            };

            return(Ok(UserWithNoRights));
        }