예제 #1
0
        public RedirectToPageResult Complete(SchoolPlanner.Models.Task item)
        {
            SchoolPlanner.Models.Task originalItem = Task.SingleOrDefault(x => x.TaskID == item.TaskID);
            originalItem.isDone = true;

            return(RedirectToPage("./Index"));
        }
예제 #2
0
        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());
        }
예제 #3
0
        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());
        }
예제 #4
0
        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"));
        }