// DELETE public async Task DeleteRestaurantAsync() { RestaurantAccessor restaurantCRUD = new RestaurantAccessor(); try { await restaurantCRUD.DeleteRestaurantAsync(this.ID); } catch { throw; } }
// Does return inactive ("deleted") restaurants public static Restaurant GetRestaurantByID(int id) { RestaurantAccessor restaurantCRUD = new RestaurantAccessor(); Restaurant r; try { r = DataToLibrary(restaurantCRUD.GetRestaurantByID(id)); } catch { throw; } return(r); }
// UPDATE public async Task UpdateRestaurantAsync(string name, string location, string cuisine, string specialty, string phoneNumber, string webAddress, string type, string hours) { RestaurantAccessor restaurantCRUD = new RestaurantAccessor(); try { await restaurantCRUD.UpdateRestaurantAsync(this.ID, name, location, cuisine, specialty, phoneNumber, webAddress, type, hours); } catch { throw; } }
public RestaurantRepository(LocalGourmetDBEntities db) { crud = new RestaurantAccessor(db); }
public RestaurantRepository() { crud = new RestaurantAccessor(); }
// READ // Does not return inactive ("deleted") restaurants public static List <Restaurant> GetRestaurants() { RestaurantAccessor restaurantCRUD = new RestaurantAccessor(); return(restaurantCRUD.GetRestaurants().Select(x => DataToLibrary(x)).ToList()); }
// CREATE public async Task AddRestaurantAsync() { DL.Restaurant restaurant = LibraryToData(this); RestaurantAccessor ra = new RestaurantAccessor(); await ra.AddRestaurantAsync(restaurant); }