示例#1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(Comment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CommentExists(Comment.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Accounts.Add(Account);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
示例#3
0
        public async Task OnPostAsync()
        {
            foreach (var item in Commentss)
            {
                _context.Comments.Update(item);
                _context.Entry(item).State = EntityState.Modified;
            }
            await _context.SaveChangesAsync();

            Commentss = await _context.Comments
                        .Include(c => c.Professor)
                        .Where(x => !x.Verfied)
                        .OrderBy(x => x.ProfessorID)
                        .ToListAsync();
        }
示例#4
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Course = await _context.Courses.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
示例#5
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Professor = await _context.Professors.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
示例#6
0
        public async Task <IActionResult> OnPostAsync(byte?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            University = await _context.Universities.FindAsync(id);

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

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