public List <Schools.Student> GetAllStudent(Schools.Student student) { var studentModel = _studentRepository.GetAll(); if (!string.IsNullOrWhiteSpace(student.Name)) { studentModel = studentModel.Where(c => c.Name.Contains(student.Name)); } if (!string.IsNullOrWhiteSpace(student.Class)) { studentModel = studentModel.Where(c => c.Class.Contains(student.Class)); } return(studentModel.ToList()); }
public void UpdateStudent(Schools.Student student) { var studentModel = _studentRepository.Get(student.Id); if (studentModel != null) { studentModel.Name = student.Name; studentModel.Class = student.Class; studentModel.Birthday = student.Birthday; studentModel.Sex = student.Sex; studentModel.Department = student.Department; } else { throw new ApplicationException("Network failure, please refresh and try again!"); } }
public Schools.Student CreateStudent(Schools.Student student) { return(_studentRepository.Insert(student)); }