public bool Update(Student student) { var existingEntry = _objectFactory.GetRepositoryInstance<Student>().GetById(student.Id); if (existingEntry == null) return false; _objectFactory.GetRepositoryInstance<Student>().Detach(existingEntry); _objectFactory.GetRepositoryInstance<Student>().Update(student); try { _objectFactory.Commit(); return true; } catch { return false; } }
public Guid? Create(Student student) { _objectFactory.GetRepositoryInstance<Student>().Add(student); _objectFactory.Commit(); return _objectFactory.GetRepositoryInstance<Student>().Find(x => x.Id == student.Id).FirstOrDefault().Id; }
public EditStudentViewModel() { Student = new Student(); AllFaculties = new List<SelectListItem>(); }