public async Task <IActionResult> Update(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()))
            {
                if (await _checkProvider.CheckIfRecordExists("Classifications", "ClassificationID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var Project = await _projectProvider.UpdateGet(CurrentUser.Id, Id);

//                var u = await _classificationProvider.CreateGetSequence(CurrentUser.Id);
                var Statuses = await _masterListProvider.StatusList(CurrentUser.Id);

                var projectTypes = await _projectTypeProvider.List(CurrentUser.Id);

                var SecurityLevels = await _securityLevelProvider.List(CurrentUser.Id);

                Project.Statuses = Statuses;
                //      Project.ProjectTypes = projectTypes;

                Project.SecurityLevels = SecurityLevels;
                return(Ok(Project));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
        public async Task <IActionResult> Update(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()))
            {
                if (await _checkProvider.CheckIfRecordExists("Classificationroles", "ClassificationRoleID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var ClassificationRole = await _classificationRoleProvider.UpdateGet(CurrentUser.Id, Id);

                ClassificationRole = await UpdateAddDropDownBoxes(ClassificationRole, CurrentUser.Id);

                return(Ok(ClassificationRole));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Esempio n. 3
0
        public async Task <IActionResult> Update(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()))
            {
                if (await _checkProvider.CheckIfRecordExists("Classifications", "ClassificationID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var x = await _classificationProvider.UpdateGet(CurrentUser.Id, Id);

                var u = await _classificationProvider.CreateGetSequence(CurrentUser.Id);

                var z = await _masterListProvider.StatusList(CurrentUser.Id);

                var icons = await _masterListProvider.IconList(CurrentUser.Id);

                x.Icons = icons;

                x.DropDownSequences = u;
                x.Statuses          = z;
                return(Ok(x));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Esempio n. 4
0
        public async Task <IActionResult> LanguageUpdate(int Id, [FromQuery(Name = "BaseType")] string BaseType)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser
                                             , "ApplicationRight"
                                             , BaseType + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                if (await _checkProvider.CheckIfRecordExists($"{BaseType}Languages", $"{BaseType}LanguageId", Id) == 0)
                //PETER TODO WHY this check, should return empty list. No error
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }

                var BaseLanguage = await _baseProvider.UpdateGet(BaseType, Id, CurrentUser.Id);

                BaseLanguage.BaseType       = BaseType;
                BaseLanguage.BaseLanguageId = Id;
                BaseLanguage = await UpdateAddDropDownBoxes(BaseLanguage, CurrentUser.Id);

                return(Ok(BaseLanguage));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Esempio n. 5
0
        public async Task <IActionResult> Delete(int Id, [FromQuery(Name = "IsFrom")] bool IsFrom = true)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                if (await _checkProvider.CheckIfRecordExists("ProjectTypeMatrixs", "ProjectTypeMatrixID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var ProjectTypeMatrix = await _projectTypeMatrixProvider.DeleteGet(CurrentUser.Id, Id);

                ProjectTypeMatrix.IsFrom = IsFrom;
                return(Ok(ProjectTypeMatrix));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
        public async Task <IActionResult> Update(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()))
            {
                if (await _checkProvider.CheckIfRecordExists("UserMenus", "UserMenuID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var UserMenu = await _frontUserMenuProvider.UpdateGet(Id);

                var iconslist = await _masterListProvider.IconList(CurrentUser.Id);

                var Pages = await _pageProvider.ListForMenu(CurrentUser.Id);

                var UserMenuSequences = await _frontUserMenuProvider.CreateGetSequence(CurrentUser.Id);

                UserMenu.UserMenuTypesLeft = await _userMenuTypeProvider.LeftList(CurrentUser.Id);

                UserMenu.UserMenuTypesRight = await _userMenuTypeProvider.RightList(CurrentUser.Id);

                UserMenuSequences.Add(new SequenceList {
                    Sequence = UserMenuSequences.Count, Name = "Add at the end"
                });
                UserMenu.UserMenus = UserMenuSequences;
                UserMenu.Icons     = iconslist;
                UserMenu.Pages     = Pages;
                UserMenu.UserId    = CurrentUser.Id;
                return(Ok(UserMenu));

                //return Ok(await _userMenuProvider.UserMenuUpdateGet(CurrentUser.Id, Id));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Esempio n. 7
0
        public async Task <IActionResult> Update(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()))
            {
                if (await _checkProvider.CheckIfRecordExists("ClassificationPages", "ClassificationPageID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var cps = new ClassificationPageSectionUpdateGet();
                cps = await _classificationPageSectionProvider.UpdateGet(CurrentUser.Id, Id);

                cps.ContentTypes = await _contentTypeProvider.List(CurrentUser.Id);

                cps.PageSectionTypes = await _pageSectionTypeProvider.List(CurrentUser.Id);

                cps.PageSectionDataTypes = await _pageSectionDataTypeProvider.List(CurrentUser.Id);

                cps.SortBys = await _masterListProvider.SortByList(CurrentUser.Id);

                cps.Sequences = await _classificationPageSectionProvider.SequenceListBySectionIdGet(CurrentUser.Id, Id);

                var intlist = new List <int>();
                intlist.Add(1);
                intlist.Add(2);

                cps.OneTwoColumnSource = intlist;

                return(Ok(cps));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Esempio n. 8
0
        public async Task <IActionResult> Delete(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()))
            {
                if (await _checkProvider.CheckIfRecordExists("Persons", "PersonID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var Person = await _userProvider.DeleteGetPerson(CurrentUser.Id, Id);

                var User = await _userProvider.DeleteGetUser(CurrentUser.Id, Id);

                var PersonUser = new UserDeleteGet();
                PersonUser.PersonId          = User.PersonId;
                PersonUser.UserName          = User.UserName;
                PersonUser.Email             = User.Email;
                PersonUser.SecurityLevelName = User.SecurityLevelName;
                PersonUser.Salutation        = Person.Salutation;
                PersonUser.FirstName         = Person.FirstName;
                PersonUser.MiddleName        = Person.MiddleName;
                PersonUser.LastName          = Person.LastName;
                PersonUser.PersonalTitle     = Person.PersonalTitle;
                PersonUser.Suffix            = Person.Suffix;
                PersonUser.NickName          = Person.NickName;
                PersonUser.FirstNameLocal    = Person.FirstNameLocal;
                PersonUser.MiddleNameLocal   = Person.MiddleNameLocal;
                PersonUser.GenderName        = Person.GenderName;
                PersonUser.BirthDate         = Person.BirthDate;
                PersonUser.OrganizationName  = Person.OrganizationName;
                PersonUser.CreatorName       = Person.CreatorName;
                PersonUser.CreatorId         = Person.CreatorId;
                PersonUser.CreatedDate       = Person.CreatedDate;
                PersonUser.ModifierName      = Person.ModifierName;
                PersonUser.ModifierId        = Person.ModifierId;
                PersonUser.ModifiedDate      = Person.ModifiedDate;


                return(Ok(PersonUser));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
        public async Task <IActionResult> LanguageUpdate(int Id)
        {
            if (await _checkProvider.CheckIfRecordExists("UserMenuTemplateLanguages", "UserMenuTemplateLanguageID", Id) == 0)
            {
                return(BadRequest(new
                {
                    IsSuccess = false,
                    Message = "No record with this 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()))
            {
                return(Ok(await _userMenuTemplateProvider.LanguageUpdateGet(CurrentUser.Id, Id)));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
        public async Task <IActionResult> View(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()))
            {
                if (await _checkProvider.CheckIfRecordExists("PersonTelecoms", "PersonTelecomID", Id) == 0)
                {
                    return(BadRequest(new
                    {
                        IsSuccess = false,
                        Message = "No record with this ID",
                    }));
                }
                var x = await _personTelecomProvider.DeleteGet(CurrentUser.Id, Id);

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