public int InsertStudent(Student student) { EntityFramework.Student efStudent = AutoMapper.Mapper.Map <EntityFramework.Student>(student); _context.Students.Add(efStudent); Save(); return(efStudent.Id); }
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(); } }