Beispiel #1
0
        public async Task <IActionResult> OnGetCompleteAsync(int id, string sortOrder, string searchString)
        {
            if (!TaskExists(id))
            {
                NotFound();
            }

            CurrentSort   = sortOrder;
            CurrentFilter = searchString;

            Task = await _db.Task.FirstOrDefaultAsync(m => m.ID == id);

            Task.Status = (int)StatusTypes.Complete;

            _db.Attach(Task).State = EntityState.Modified;

            try
            {
                await _db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TaskExists(Task.ID))
                {
                    NotFound();
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage(new { sortOrder = CurrentSort, searchString = CurrentFilter }));
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Task = await _context.Task.FirstOrDefaultAsync(m => m.ID == id);

            if (Task == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Task = await _context.Task.FindAsync(id);

            if (Task != null)
            {
                _context.Task.Remove(Task);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }