public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Vendor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorExists(Vendor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Departments.Add(Department); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Vendor = await _context.Vendors.FindAsync(id); if (Vendor != null) { _context.Vendors.Remove(Vendor); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Department = await _context.Departments.FindAsync(id); if (Department != null) { _context.Departments.Remove(Department); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ParkInfo = await _context.ParkInfo.FindAsync(id); if (ParkInfo != null) { _context.ParkInfo.Remove(ParkInfo); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Location = await _context.Locaitons.FindAsync(id); if (Location != null) { _context.Locaitons.Remove(Location); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var isAuthorized = await AuthorizationService.AuthorizeAsync( User, Attraction, AttractionOperations.Create); if (!isAuthorized.Succeeded) { return(new ChallengeResult()); } _context.Attractions.Add(Attraction); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }