public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Settlements).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SettlementsExists(Settlements.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(string stripeEmail, string stripeToken, int payment_id) { if (!ModelState.IsValid) { return(Page()); } var customers = new CustomerService(); var charges = new ChargeService(); var customer = customers.Create(new CustomerCreateOptions { Email = stripeEmail, SourceToken = stripeToken }); Payments payments = _context.Payments.Find(payment_id); long amount = (long)(payments.Amount * 100); var charge = charges.Create(new ChargeCreateOptions { Amount = amount, Description = "Medical Fee", Currency = "lkr", CustomerId = customer.Id }); payments.IsReceived = 1; //var payment = _context.Payments.Where(i => i.Id == Payments.Id).First(); //payment.IsReceived = 1; //_context.SaveChanges(); //_context.Attach(Payments).State = EntityState.Modified; _context.Attach(payments).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentsExists(Payments.Id)) { return(NotFound()); } else { throw; } } return(LocalRedirect("/Payment/Details?id=" + payments.Id.ToString())); //return RedirectToRoute("/Payment/Details?id=" + payments.Id.ToString()); //return RedirectToPage("/Payment/Details?id="+payments.Id.ToString()); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Users.Add(Users); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } UserRoleGroups = await _context.UserRoleGroups.FindAsync(id); if (UserRoleGroups != null) { _context.UserRoleGroups.Remove(UserRoleGroups); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } SubscriptionInvoices = await _context.SubscriptionInvoices.FindAsync(id); if (SubscriptionInvoices != null) { _context.SubscriptionInvoices.Remove(SubscriptionInvoices); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Payments = await _context.Payments.FindAsync(id); if (Payments != null) { _context.Payments.Remove(Payments); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }