示例#1
0
        // DELETE
        public async Task DeleteRestaurantAsync()
        {
            RestaurantAccessor restaurantCRUD = new RestaurantAccessor();

            try
            {
                await restaurantCRUD.DeleteRestaurantAsync(this.ID);
            }
            catch
            {
                throw;
            }
        }
示例#2
0
        // 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);
        }
示例#3
0
        // 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();
 }
示例#6
0
        // READ
        // Does not return inactive ("deleted") restaurants
        public static List <Restaurant> GetRestaurants()
        {
            RestaurantAccessor restaurantCRUD = new RestaurantAccessor();

            return(restaurantCRUD.GetRestaurants().Select(x => DataToLibrary(x)).ToList());
        }
示例#7
0
 // CREATE
 public async Task AddRestaurantAsync()
 {
     DL.Restaurant      restaurant = LibraryToData(this);
     RestaurantAccessor ra         = new RestaurantAccessor();
     await ra.AddRestaurantAsync(restaurant);
 }