Example #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,DOB,Address,Email,Major")] Student student)
        {
            // if(student.DOB > DateTime.Now)
            // {
            //   //error Message;
            //   ViewBag.doberror = "Dude, this one have not been born yet!";
            // }
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View());
        }