예제 #1
0
        //public async Task<Paged<UserDto>> GetAllAsync(UserFilterDto dto)
        //{
        //    var entity = await _userRepositories.GetAllAsync(dto);

        //    var result = entity.Adapt<Paged<UserDto>>();

        //    return result;
        //}

        public async Task <UserDto> DeleteAsync(UserDeleteDto dto)
        {
            var entity = await _userRepositories.GetByIdAsync(dto.Id);

            await _userRepositories.DeleteAsync(entity);

            return(new UserDto());
        }
예제 #2
0
        public async Task DeleteUserAsync(UserDeleteDto user)
        {
            //remove time portion
            user.EndDate = user.EndDate?.Date;

            var userEntity = await DbSet
                             .FirstAsync(u => u.SystemUserId == user.SystemUserId);

            Mapper.Map(user, userEntity);
        }
예제 #3
0
        public async Task <ActionResult> DeleteUser(decimal id, UserDeleteDto user)
        {
            if (id != user.SystemUserId)
            {
                throw new Exception($"The system user ID from the query string does not match that of the body.");
            }

            var response = await _userService.DeleteUserAsync(user);

            if (response.NotFound)
            {
                return(NotFound());
            }

            if (response.Errors.Count > 0)
            {
                return(ValidationUtils.GetValidationErrorResult(response.Errors, ControllerContext));
            }

            return(NoContent());
        }
        public OperationResult Delete(UserDeleteDto dto)
        {
            if (dto == null)
            {
                throw new ArgumentNullException(nameof(dto));
            }

            var entity = _repository.GetById(dto.Id);

            if (entity == null)
            {
                return(new OperationResult
                {
                    Success = false,
                    Message = "User is not found"
                });
            }

            _repository.Delete(entity);
            return(new OperationResult
            {
                Success = true
            });
        }
예제 #5
0
        public async Task <IActionResult> DeleteUser([FromHeader] Guid tenantId, [FromHeader] string token, [FromHeader] Guid transactionId, [FromHeader] Guid organizationId, [FromBody] UserDeleteDto dto)
        {
            var response = await _userService.DeleteAsync(dto);

            return(Ok(response));
        }