public ICollection <PlayerUser> GetAll() { using (var context = new HotelTamagotchiDBEntities()) { return(context.PlayerUsers.ToList()); } }
public ICollection <HotelRoomSize> GetAll() { using (var context = new HotelTamagotchiDBEntities()) { return(context.HotelRoomSizes.ToList()); } }
public void Edit(HotelRoom entity) { if (entity != null) { using (var context = new HotelTamagotchiDBEntities()) { context.Entry(entity).State = EntityState.Modified; context.SaveChanges(); } } }
public void Add(HotelRoom entity) { if (entity != null) { using (var context = new HotelTamagotchiDBEntities()) { context.HotelRooms.Add(entity); context.SaveChanges(); } } }
public ICollection <HotelRoom> GetAll() { using (var context = new HotelTamagotchiDBEntities()) { return(context.HotelRooms .Include(h => h.HotelBooking) .Include(h => h.HotelRoomType) .Include(h => h.HotelRoomSize) .ToList()); } }
public void Delete(HotelRoomSize entity) { if (entity != null) { using (var context = new HotelTamagotchiDBEntities()) { context.Entry(entity).State = EntityState.Deleted; context.SaveChanges(); } } }
public void Add(PlayerUser entity) { if (entity != null) { using (var context = new HotelTamagotchiDBEntities()) { context.PlayerUsers.Add(entity); context.SaveChanges(); } } }
public ICollection <Tamagotchi> GetAll() { using (var context = new HotelTamagotchiDBEntities()) { return(context.Tamagotchis .Include(t => t.HotelBooking) .Include(t => t.HotelBooking.HotelRoom) .Include(t => t.PlayerUser) .ToList()); } }
public ICollection <Tamagotchi> GetAllTamagotchisALiveAndNoHotelRoom() { using (var context = new HotelTamagotchiDBEntities()) { return(context.Tamagotchis .Include(t => t.HotelBooking) .Include(t => t.HotelBooking.HotelRoom) .Include(t => t.PlayerUser) .Where(t => t.IsALive == true && t.HotelBooking == null) .ToList()); } }
// Extra public void SetAllTamagotchiHotelRoomToNull(HotelBooking entity) { if (entity != null) { using (var context = new HotelTamagotchiDBEntities()) { foreach (var tamagotchi in entity.Tamagotchis) { tamagotchi.HotelBooking = null; tamagotchi.HotelRoomId = null; context.Entry(tamagotchi).State = EntityState.Modified; context.SaveChanges(); } } } }
public PlayerUser GetWhereId(int?id) { if (id != null || id != 0) { using (var context = new HotelTamagotchiDBEntities()) { return(context.PlayerUsers .Where(p => p.PlayerUserId == id) .FirstOrDefault()); } } else { return(null); } }
public HotelRoom GetWhereId(int?id) { if (id != null || id != 0) { using (var context = new HotelTamagotchiDBEntities()) { return(context.HotelRooms .Include(h => h.HotelBooking) .Include(h => h.HotelRoomType) .Include(h => h.HotelRoomSize) .Where(t => t.HotelRoomId == id) .FirstOrDefault()); } } else { return(null); } }
//Extra public ICollection <Tamagotchi> GetAllTamagotchisWherePlayerId(int playerUserId) { if (playerUserId != 0) { using (var context = new HotelTamagotchiDBEntities()) { return(context.Tamagotchis .Include(t => t.HotelBooking) .Include(t => t.HotelBooking.HotelRoom) .Include(t => t.PlayerUser) .Where(t => t.PlayerUser.PlayerUserId == playerUserId) .ToList()); } } else { return(null); } }
public Tamagotchi GetWhereId(int?id) { if (id != null || id != 0) { using (var context = new HotelTamagotchiDBEntities()) { return(context.Tamagotchis .Include(t => t.HotelBooking) .Include(t => t.HotelBooking.HotelRoom) .Include(t => t.PlayerUser) .Where(t => t.TamagotchiId == id) .FirstOrDefault()); } } else { return(null); } }