public void AddSpeciality(Speciality speciality) { if (speciality == null) throw new ArgumentNullException("speciality"); using (SpecialityRepository repository = new SpecialityRepository()) { var existedSpecialities = repository.GetFiltered(s => s.Name == speciality.Name && s.UniversityId == speciality.UniversityId); if (existedSpecialities != null) { // TODO: throw existing speciality of that university } repository.Add(speciality); repository.Commit(); } }
public void UpdateSpeciality(Speciality speciality) { if (speciality == null) throw new ArgumentNullException("speciality"); using (SpecialityRepository repository = new SpecialityRepository()) { repository.Modify(speciality); repository.Commit(); } }
/// <summary> /// Deprecated Method for adding a new object to the Specialities EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToSpecialities(Speciality speciality) { base.AddObject("Specialities", speciality); }
/// <summary> /// Create a new Speciality object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="category">Initial value of the Category property.</param> public static Speciality CreateSpeciality(global::System.Guid id, global::System.String name, global::System.String category) { Speciality speciality = new Speciality(); speciality.Id = id; speciality.Name = name; speciality.Category = category; return speciality; }