예제 #1
0
        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
                });
            }
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
 public ActionResult Detail(int id)
 {
     return(_buyerRepo.GetBuyerById(id));
 }