// To protect from overposting attacks, enable the specific properties you want to bind to. // For more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(currency).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!currencyExists(currency.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.currency.Add(currency); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } currency = await _context.currency.FindAsync(id); if (currency != null) { _context.currency.Remove(currency); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var curre = (from s in _context.currency where s.record_date == cur.record_date && s.name == cur.name select s).ToList <currency>(); if (curre.Count() == 0) //jak nie ma w bazie { await cur.load(cur.record_date); cur.exchange = cur.rates[cur.name]; _context.currency.Add(cur); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }