public async Task <IActionResult> OnPostAsync(string id) { if (!User.IsInRole(Constants.Bookkeeper) && !User.IsInRole(Constants.Administrator)) { return(NotFound()); } if (id == null) { return(NotFound()); } PerformanceDate = await Context.PerformanceDates.FindAsync(id); if (PerformanceDate != null) { Context.PerformanceDates.Remove(PerformanceDate); await Context.SaveChangesAsync(); } return(Redirect("./IndexDates?id=" + PerformanceDate.PerformanceId)); }
public async Task <IActionResult> OnGetAsync(string id) { if (!User.IsInRole(Constants.Bookkeeper) && !User.IsInRole(Constants.Administrator)) { return(NotFound()); } if (id == null) { return(NotFound()); } PerformanceDate = await Context.PerformanceDates .Include(p => p.Performance) .FirstOrDefaultAsync(m => m.Id == id); if (PerformanceDate == null) { return(NotFound()); } return(Page()); }