public async Task <IActionResult> DeleteAsync(int id) { try { var user = await manageUser.GetUserAsync(id); if (!manageUser.IsUserValidToDelete(user)) { logger.LogInformation("You can not delete as the user have association with Project/Task"); return(BadRequest("You can not delete as the user have association with Project/Task")); } await manageUser.DeleteUserAsync(user); return(Ok(user.UserId)); } catch (Exception ex) { logger.LogError(ex.Message); return(StatusCode((int)HttpStatusCode.InternalServerError, "Internal Server error. Try again later")); } }