public IActionResult GetCondominiumById([FromServices] CondominiumDao condominiumDao, [FromRoute] Guid id) { try { var condominium = condominiumDao.GetCondominiumById(id); return(IsAValidOperation() ? RequestResponse(HttpStatusCode.OK, result: condominium) : RequestResponse(HttpStatusCode.NotFound, "kipercondominio/api/v1/condominiums", isError: true)); } catch (Exception ex) { var error = JsonConvert.SerializeObject(ex); _logger.LogError(error); return(RequestResponse(HttpStatusCode.BadRequest, isError: true, result: "Ocorreu um erro ao obter a conta")); } }
public IActionResult GetAllCondominiums([FromServices] CondominiumDao condominiumDao) { try { var condominiums = condominiumDao.ListOfAllCondominiums(); return(IsAValidOperation() ? RequestResponse(HttpStatusCode.OK, result: condominiums) : RequestResponse(HttpStatusCode.NotFound, "kipercondominio/api/v1/condominiums", isError: true)); } catch (Exception ex) { var error = JsonConvert.SerializeObject(ex); _logger.LogError(error); return(RequestResponse(HttpStatusCode.BadRequest, isError: true, result: "Ocorreu um erro ao listar os condomínios")); } }