public async Task <BizResponse> CancelTransaction(TransactionCancelModel transactionCancelModel) //add by lalji 23/08/2019 { var buyer = await _buyerRepository.GetBuyerById(transactionCancelModel); try { if (buyer == null) { BizResponse bizResponse = new BizResponse(); bizResponse.ErrorCode = Domain.Enum.enErrorCode.TransactionNotFoundError; bizResponse.StatusCode = (int)TransactionStatus.ProviderFail; bizResponse.StatusMessage = "transaction not found"; return(bizResponse); } else { buyer.StatusChangeToCancleStatus(); buyer.InsertDateAndTime(); await _buyerRepository.UpdateBuyerData(buyer); BizResponse bizResponse = new BizResponse(); bizResponse.ErrorCode = Domain.Enum.enErrorCode.Success; bizResponse.StatusCode = (int)TransactionStatus.Success; bizResponse.StatusMessage = "Transaction cancelled successfully"; return(bizResponse); } } catch (Exception) { return(new BizResponse { ErrorCode = Domain.Enum.enErrorCode.InternalError, StatusMessage = "Internel error", StatusCode = (int)TransactionStatus.ProviderFail }); } }
public IHttpActionResult GetBuyerById(int buyerId) { try { return(Ok(buyerRepository.GetBuyerById(buyerId))); } catch (Exception ex) { HttpResponseMessage msg = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent($"Error getting buyer by Id. {ex.Message}"), ReasonPhrase = string.Empty }; throw new HttpResponseException(msg); } }
public ActionResult Detail(int id) { return(_buyerRepo.GetBuyerById(id)); }