Exemple #1
0
        public async Task <IActionResult> Create([Bind("Id,Name,LastName,Nif,Gender,BirthDate,Phone,Email,Address,Cp,Active,StudentId,TeacherId,TutorId")] Person person)
        {
            if (ModelState.IsValid)
            {
                _context.Add(person);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("Id,Average,EnrollmentDay,PersonId")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PersonId"] = new SelectList(_context.Person, "Id", "Name", student.PersonId);
            return(View(student));
        }