public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Worker).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkerExists(Worker.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
//[BindProperty] //public Worker Worker { get; set; } public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Project.Add(Project); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Worker = await _context.Worker.FindAsync(id); if (Worker != null) { _context.Worker.Remove(Worker); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Project = await _context.Project.FindAsync(id); if (Project != null) { _context.Project.Remove(Project); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }