fix a copy paste error
This commit is contained in:
parent
34869f1ea9
commit
6d808b7a6e
|
@ -15,13 +15,13 @@ namespace Plattform.DB
|
||||||
return ctx.Availabilities.ToList();
|
return ctx.Availabilities.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool CreateAvailability(Availability city)
|
public bool CreateAvailability(Availability availability)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Availabilities.Add(city);
|
ctx.Availabilities.Add(availability);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -33,14 +33,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateAvailability(Availability city)
|
public bool UpdateAvailability(Availability availability)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Availabilities.Attach(city);
|
ctx.Availabilities.Attach(availability);
|
||||||
ctx.Entry(city).State = System.Data.Entity.EntityState.Modified;
|
ctx.Entry(availability).State = System.Data.Entity.EntityState.Modified;
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -52,14 +52,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public bool DeleteAvailability(Availability city)
|
public bool DeleteAvailability(Availability availability)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Availabilities.Attach(city);
|
ctx.Availabilities.Attach(availability);
|
||||||
ctx.Availabilities.Remove(city);
|
ctx.Availabilities.Remove(availability);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -15,13 +15,13 @@ namespace Plattform.DB
|
||||||
return ctx.Hotels.ToList();
|
return ctx.Hotels.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool CreateHotel(Hotel city)
|
public bool CreateHotel(Hotel hotel)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Hotels.Add(city);
|
ctx.Hotels.Add(hotel);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -33,14 +33,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateHotel(Hotel city)
|
public bool UpdateHotel(Hotel hotel)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Hotels.Attach(city);
|
ctx.Hotels.Attach(hotel);
|
||||||
ctx.Entry(city).State = System.Data.Entity.EntityState.Modified;
|
ctx.Entry(hotel).State = System.Data.Entity.EntityState.Modified;
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -52,14 +52,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public bool DeleteHotel(Hotel city)
|
public bool DeleteHotel(Hotel hotel)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Hotels.Attach(city);
|
ctx.Hotels.Attach(hotel);
|
||||||
ctx.Hotels.Remove(city);
|
ctx.Hotels.Remove(hotel);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -14,13 +14,13 @@ namespace Plattform.DB
|
||||||
return ctx.Rooms.ToList();
|
return ctx.Rooms.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool CreateRoom(Room city)
|
public bool CreateRoom(Room room)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Rooms.Add(city);
|
ctx.Rooms.Add(room);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -32,14 +32,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateRoom(Room city)
|
public bool UpdateRoom(Room room)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Rooms.Attach(city);
|
ctx.Rooms.Attach(room);
|
||||||
ctx.Entry(city).State = System.Data.Entity.EntityState.Modified;
|
ctx.Entry(room).State = System.Data.Entity.EntityState.Modified;
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -51,14 +51,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public bool DeleteRoom(Room city)
|
public bool DeleteRoom(Room room)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.Rooms.Attach(city);
|
ctx.Rooms.Attach(room);
|
||||||
ctx.Rooms.Remove(city);
|
ctx.Rooms.Remove(room);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -15,13 +15,13 @@ namespace Plattform.DB
|
||||||
return ctx.RoomTypes.ToList();
|
return ctx.RoomTypes.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool CreateRoomType(RoomType city)
|
public bool CreateRoomType(RoomType roomType)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.RoomTypes.Add(city);
|
ctx.RoomTypes.Add(roomType);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -33,14 +33,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateRoomType(RoomType city)
|
public bool UpdateRoomType(RoomType roomType)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.RoomTypes.Attach(city);
|
ctx.RoomTypes.Attach(roomType);
|
||||||
ctx.Entry(city).State = System.Data.Entity.EntityState.Modified;
|
ctx.Entry(roomType).State = System.Data.Entity.EntityState.Modified;
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -52,14 +52,14 @@ namespace Plattform.DB
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public bool DeleteRoomType(RoomType city)
|
public bool DeleteRoomType(RoomType roomType)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Context ctx = new Context())
|
using (Context ctx = new Context())
|
||||||
{
|
{
|
||||||
ctx.RoomTypes.Attach(city);
|
ctx.RoomTypes.Attach(roomType);
|
||||||
ctx.RoomTypes.Remove(city);
|
ctx.RoomTypes.Remove(roomType);
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue