public RedirectToPageResult Complete(SchoolPlanner.Models.Task item) { SchoolPlanner.Models.Task originalItem = Task.SingleOrDefault(x => x.TaskID == item.TaskID); originalItem.isDone = true; return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Task = await _context.Tasks .Include(t => t.Subject).FirstOrDefaultAsync(m => m.TaskID == id); if (Task == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Task = await _context.Tasks .Include(t => t.Subject).FirstOrDefaultAsync(m => m.TaskID == id); if (Task == null) { return(NotFound()); } ViewData["SubjectID"] = new SelectList(_context.Subjects, "SubjectID", "SubjectID"); return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Task = await _context.Tasks.FindAsync(id); if (Task != null) { _context.Tasks.Remove(Task); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }