public async Task <IActionResult> DeleteUserLog(int id) { try { var user = await repository.GetUserLogByIdAsync(id); if (user == null) { return(Ok(new ConsumptionResponse() { success = false, message = "The user was not found!" })); } repository.DeleteModelAsync(user); if (!await work.SaveChangedAsync()) { return(Ok(new ConsumptionResponse() { success = false, message = $"Deleting post {id} failed when saving." })); } return(Ok(new ConsumptionResponse() { success = true })); } catch (Exception ex) { return(Ok(new ConsumptionResponse() { success = false, message = ex.Message })); } }