public async Task <IActionResult> Create([Bind("Id,Batch,Year")] Batches batches)
        {
            if (ModelState.IsValid)
            {
                _context.Add(batches);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(batches));
        }
        public async Task <IActionResult> Create(Student nst)
        {
            if (ModelState.IsValid)
            {
                _db.Add(nst);
                await _db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(nst));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Duration")] Courses courses)
        {
            if (ModelState.IsValid)
            {
                _context.Add(courses);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(courses));
        }
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,UserName,Password")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
      public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,CoursesID,BatchesID,PhoneNumber")] Registration registration)
      {
          if (ModelState.IsValid)
          {
              _context.Add(registration);
              await _context.SaveChangesAsync();

              return(RedirectToAction(nameof(Index)));
          }
          ViewData["BatchesID"] = new SelectList(_context.BatchTable, "Id", "Id", registration.BatchesID);
          ViewData["CoursesID"] = new SelectList(_context.CourseTable, "Id", "Name", registration.CoursesID);
          return(View(registration));
      }