public static int Save(StudentBrother studBrother) { var a = new StudentBrother { BrotherId = studBrother.BrotherId, StudentSelectedBroId = studBrother.StudentSelectedBroId, StudentId = studBrother.StudentId, Student = studBrother.Student, Student1 = studBrother.Student1 }; using (_d = new DataRepository <StudentBrother>()) { if (studBrother.BrotherId > 0) { _d.Update(a); } else { _d.Add(a); } _d.SaveChanges(); } return(a.BrotherId); }
public static bool Delete(StudentBrother studBrother) { using (_d = new DataRepository <StudentBrother>()) { _d.Delete(studBrother); _d.SaveChanges(); } return(true); }