public IHttpActionResult Add([FromBody] mpesaObj dta) { var result = new ExecutionResult(false, "error"); var repository = new MpesaC2BRepository(); result = repository.AddMpesaC2B(dta); if (result.IsOkay) { return(new NegotiatedContentResult <ExecutionResult>(HttpStatusCode.OK, result, this)); } else { return(new NegotiatedContentResult <ExecutionResult>(HttpStatusCode.NotFound, result, this)); } }
public IHttpActionResult GetMpesaC2B(NeedDataSourceEventArgs args) { var repo = new MpesaC2BRepository(); try { ExecutionResult res = repo.GetMpesaC2B(args); if (res.IsOkay) { return(new NegotiatedContentResult <ExecutionResult>(HttpStatusCode.OK, res, this)); } else { return(new NegotiatedContentResult <ExecutionResult>(HttpStatusCode.NotFound, res, this)); } } catch (Exception ex) { var res = new ExecutionResult(false, ex.Message, ex); return(new NegotiatedContentResult <ExecutionResult>(HttpStatusCode.InternalServerError, res, this)); } }