public async Task <HttpResponseMessage> GetProjects(int?id = null) { try { var repository = new CrowdFundingTransactions(); var result = await repository.ReadProjects(); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message)); } }
public async Task <HttpResponseMessage> GetProjects([FromUri] TransactionCriteria criteria) { try { using (var repository = new CrowdFundingTransactions()) { var transaction = await repository.ReadProjects(criteria); if (transaction.Result == TransResult.Success) { return(Request.CreateResponse(HttpStatusCode.OK, transaction.ReturnObject)); } else { return(Request.CreateResponse(HttpStatusCode.OK, transaction.Message)); } } } catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message)); } }