Ejemplo n.º 1
0
        public virtual void Delete(int id)
        {
            var temp = FindById(id);

            if (temp != null)
            {
                context.Remove <TEntity>(temp);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes the hotel
        /// </summary>
        /// <param name="id">hotel to be deleted</param>
        /// <returns></returns>
        public async Task DeleteHotel(int id)
        {
            Hotel hotel = await GetHotel(id);

            _context.Remove(hotel);
            await _context.SaveChangesAsync();
        }
Ejemplo n.º 3
0
 public void DeleteHotel(int id)
 {
     using (var hotelDbContext = new HotelDbContext())
     {
         var hotel = GetHotelById(id);
         hotelDbContext.Remove(hotel);
         hotelDbContext.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public async Task DeleteHotel(int id)
 {
     using (var hotelDbContext = new HotelDbContext())
     {
         var deletedHotel = hotelDbContext.Hotels.Find(id);
         hotelDbContext.Remove(deletedHotel);
         await hotelDbContext.SaveChangesAsync();
     }
 }