public async Task <IActionResult> Edit(int id, [Bind("Id,Student_Name,Student_age,Mobile_Number,Student_Address,Father_Name")] Student_participate student_participate)
        {
            if (id != student_participate.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student_participate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Student_participateExists(student_participate.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student_participate));
        }
        public async Task <IActionResult> Create([Bind("Id,Student_Name,Student_age,Mobile_Number,Student_Address,Father_Name")] Student_participate student_participate)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student_participate);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student_participate));
        }
Пример #3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Student_participate = await _context.Student_participate.FirstOrDefaultAsync(m => m.Id == id);

            if (Student_participate == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Пример #4
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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