public IActionResult Create([FromBody] StudentInfo value)
 {
     if (value == null)
     {
         return(BadRequest());
     }
     _context.StudentInfomations.Add(value);
     _context.SaveChanges();
     return(CreatedAtRoute("GetStudent", new { id = value.StudentId }, value));
 }
Beispiel #2
0
 private void CopyTestStudents()
 {
     foreach (Student student in StudentData.TestStudents)
     {
         StudentInfoContext.Students.Add(student);
         StudentInfoContext.SaveChanges();
     }
 }
        public StudentInfoController(StudentInfoContext context)
        {
            _context = context;

            if (_context.StudentInfomations.Count() == 0)
            {
                _context.StudentInfomations.Add(new StudentInfo());
                _context.SaveChanges();
            }
        }