示例#1
0
        public async Task <IActionResult> DeleteHouse(string id)
        {
            var deletionResult = await _houseService.DeleteHouseAsync(id);

            if (!deletionResult.Status)
            {
                if (deletionResult.ServerError)
                {
                    return(StatusCode(500));
                }

                if (deletionResult.Errors.Contains("Item not found."))
                {
                    return(NotFound("Item not found"));
                }

                return(BadRequest(new FailedHouseResponse
                {
                    Status = false,
                    Errors = deletionResult.Errors
                }));
            }

            return(NoContent());
        }