public List <SchoolVan> GetSchoolVansSortedByCapacity() { SchoolVanAccess context = new SchoolVanAccess(); SortSchoolVans schoolVanSort = new SortSchoolVans(); List <SchoolVan> sortedSchoolVans = schoolVanSort.GenerateSortedList(context.GetAll()); return(sortedSchoolVans); }
public void Add(Object anObject) { if (CanIAdd(anObject)) { SchoolVan newSchoolVan = anObject as SchoolVan; SchoolVanAccess context = new SchoolVanAccess(); context.Add(newSchoolVan); } }
public void Remove(Object anObject) { bool canIDelete = false; SchoolVan toDelete = anObject as SchoolVan; try { SchoolVanValidator validator = new SchoolVanValidator(); if (validator.IsValid(toDelete)) { canIDelete = true; } } catch (Exception) { throw new InvalidValueException("No se puede eliminar un objeto que no sea del tipo SchoolVan"); } if (canIDelete) { SchoolVanAccess context = new SchoolVanAccess(); context.Remove(toDelete); } }