public async Task <IActionResult> DeleteBuilding(DeleteBuildingDTO input) { try { await _buildingService.DeleteBuilding(input); return(Ok()); } catch (Exception) { return(BadRequest()); } }
public IActionResult Delete(long id) { var deletedBuilding = _buildingService.GetBuilding(id); if (deletedBuilding == null) { _logger.LogInformation("Building/Deleted object not found"); return(NotFound()); } _buildingService.DeleteBuilding(id); _logger.LogInformation("Building/Object was deleted"); return(NoContent()); }
public async Task <ActionResult <BuildingResponse> > DeleteBuilding(int id) { try { Guid accountId = new Guid(User.FindFirst(ClaimTypes.NameIdentifier)?.Value); var rs = await _buildingService.DeleteBuilding(id, accountId); if (rs == null) { return(NotFound()); } return(Ok(rs)); } catch (Exception e) { throw new CrudException(HttpStatusCode.BadRequest, "Delete Error!!!", e.InnerException?.Message); } }