Ejemplo n.º 1
0
 public int InsertStudent(Student student)
 {
     EntityFramework.Student efStudent = AutoMapper.Mapper.Map <EntityFramework.Student>(student);
     _context.Students.Add(efStudent);
     Save();
     return(efStudent.Id);
 }
Ejemplo n.º 2
0
 public void UpdateStudent(Student student)
 {
     EntityFramework.Student efStudent = _context.Students.FirstOrDefault(s => s.Id == student.Id);
     if (efStudent != null)
     {
         efStudent.FirstName             = student.FirstName;
         efStudent.LastName              = student.LastName;
         _context.Entry(efStudent).State = EntityState.Modified;
         Save();
     }
 }