public async Task <HttpResponseMessage> GetProjectCategories() { try { var repository = new CrowdFundingTransactions(); var result = await repository.ReadProjectCategories(); return(Request.CreateResponse(HttpStatusCode.OK, result)); } catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e.Message)); } }
public async Task <HttpResponseMessage> GetProjectCategories() { try { using (var repository = new CrowdFundingTransactions()) { var transaction = await repository.ReadProjectCategories(); 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)); } }