Example #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="instance"></param>
 /// <returns></returns>
 public async Task<bool> CreateTransactionAsync(Transaction instance)
 {
     db.Transactions.Add(instance);
     return await db.SaveChangesAsync() > 0;
 }
Example #2
0
 public async Task<ActionResult> PayTicket()
 {
     var tickets = await repository.GetNotPayedTicketsAsync(CurrentUser.Id);
     var ticketPrice = SportLotoSettings.TicketPrice;
     var transtaction = new Transaction()
     {
         Amount = ticketPrice,
         Quantity = tickets.Count,
         ItemTotal = ticketPrice * tickets.Count,
         ApplicationUserId = CurrentUser.Id,
         DrawingId = CurrentDrawing.Id,
         Confirmed = false,
     };
     //var createTransactionResult = await repository.CreateTransactionAsync(transtaction);
     //if (createTransactionResult)
     //{
     //    return RedirectToAction("Success", new SuccessViewModel
     //    {
     //        transaction_id = transtaction.Id,
     //        first_name = CurrentUser.UserName,
     //        last_name = CurrentUser.Surname,
     //        payment_status = "Completed",
     //        payer_email = CurrentUser.Email,
     //        payment_gross = transtaction.ItemTotal,
     //        mc_currency = "USD",
     //        custom = $"transactioId={transtaction.Id}&ticketsId={String.Join(",", tickets.Select(x => x.Id))}"
     //    });
     //}
     return RedirectToAction("Index");
 }