public async Task <IActionResult> PollReceipt(string id) { Receipt res; try { using (var context = new ApplicationDbContext()) { var contract = context.DeployedContracts.Where(p => p.TransactionHash == id).FirstOrDefault(); ContractAccess contractAccess = new ContractAccess(contract.Network); var receipt = await contractAccess.PollReceipt(id); res = new Receipt(receipt); context.Entry(contract).Entity.Receipt = res; context.DeployReceipt.Add(res); await context.SaveChangesAsync(); } return(PartialView("~/Views/Home/_Receipt.cshtml", res)); } catch (Exception e) { return(PartialView("~/Views/Shared/Error.cshtml")); } }
public async Task <ActionResult> Details(int id) { Escrow res; using (var _context = new ApplicationDbContext()) { res = await _context.DeployedContracts.Include(p => p.Receipt).Where(p => p.ID == id).FirstOrDefaultAsync(); } ContractAccess contractAccess = new ContractAccess(res.Network); var rec = await contractAccess.PollReceipt(res.TransactionHash); res.Receipt = new Receipt(rec); return(View(res)); }