示例#1
0
        public async Task <IActionResult> DeleteUserAsync(int id)
        {
            if (id == 0)
            {
                return(BadRequest("User Id must be valid"));
            }

            try
            {
                var response = await _applicationService.DeleteAsync(id);

                var webResponse = new DeleteWebResponse()
                                  .From(response);

                if (webResponse.IsSuccessful)
                {
                    return(Ok(webResponse));
                }

                return(BadRequest(webResponse.Errors));
            }
            catch (Exception ex)
            {
                var message = "Unable to delete a user";
                Console.WriteLine(ex);
                _logManager.LogError(ex, message);
                return(BadRequest(message));
            }
        }
示例#2
0
        public Task DeleteAsync(IdentityUser user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            var u = getUserDeleteViewModel(user);

            _userApplicationService.DeleteAsync(u);
            return(_unitOfWork.SaveChangesAsync());
        }
 public async Task <IActionResult> DeleteAsync(long id)
 {
     return(await _userApplicationService.DeleteAsync(id).ResultAsync());
 }