Exemple #1
0
        public async Task <AccessOutputDto> GetAllUserAccess(int userId)
        {
            AccessOutputDto  accessOutputDto  = new AccessOutputDto();
            UserAccessEntity userAccessEntity = await this.userAccessRepository.GetUserAccess(userId);

            if (userAccessEntity == null)
            {
                accessOutputDto.UserAccess = new UserAccessOutputDto()
                {
                    UserId = userId
                };
            }
            else
            {
                UserAccessOutputDto userAccessOutputDto = this.mapper.Map <UserAccessOutputDto>(userAccessEntity);
                accessOutputDto.UserAccess = userAccessOutputDto;
            }

            return(accessOutputDto);
        }
Exemple #2
0
        public async Task UpdateAllAccess(AccessOutputDto accessOutputDto)
        {
            UserAccessEntity userAccessEntity = this.mapper.Map <UserAccessEntity>(accessOutputDto.UserAccess);

            await this.userAccessRepository.UpdateUserAccess(userAccessEntity);
        }
        public async Task <ActionResult <CommonSuccessMessageOutputDTO> > UpdateUserAccess([FromBody] AccessOutputDto accessOutputDto)
        {
            try
            {
                await this.accessService.UpdateAllAccess(accessOutputDto);

                return(new CommonSuccessMessageOutputDTO()
                {
                    Success = true
                });
            }
            catch (Exception ex)
            {
                return(BadRequest(new { message = new List <string> {
                                            ex.Message
                                        } }));
            }
        }