public List <Prices> ReadAll()
 {
     using (var ctx = new MirasolContext())
     {
         return(ctx.Prices.ToList());
     }
 }
 public List <Apartment> ReadAll()
 {
     using (var ctx = new MirasolContext())
     {
         return(ctx.Apartments.ToList());
     }
 }
Beispiel #3
0
 public List <Address> ReadAll()
 {
     using (var ctx = new MirasolContext())
     {
         return(ctx.Addresses.ToList());
     }
 }
 public List <Bookings> ReadAll()
 {
     using (var ctx = new MirasolContext())
     {
         return(ctx.Bookings.ToList());
     }
 }
 public List <Facilities> ReadAll()
 {
     using (var ctx = new MirasolContext())
     {
         return(ctx.Facilities.ToList());
     }
 }
Beispiel #6
0
 public List <User> ReadAll()
 {
     using (var ctx = new MirasolContext())
     {
         return(ctx.Users.ToList());
     }
 }
        public void Delete(int id)
        {
            Prices t = Find(id);

            using (var ctx = new MirasolContext())
            {
                ctx.Prices.Attach(t);
                ctx.Prices.Remove(t);
                ctx.SaveChanges();
            }
        }
        public void Delete(int id)
        {
            Apartment t = Find(id);

            using (var ctx = new MirasolContext())
            {
                ctx.Apartments.Attach(t);
                ctx.Apartments.Remove(t);
                ctx.SaveChanges();
            }
        }
 public void Add(Prices t)
 {
     if (t == null)
     {
         throw new ArgumentNullException("t");
     }
     using (var ctx = new MirasolContext())
     {
         ctx.Prices.Add(t);
         ctx.SaveChanges();
     }
 }
        public void Update(Apartment t)
        {
            if (t == null)
            {
                throw new ArgumentNullException("t");
            }
            using (var ctx = new MirasolContext())
            {
                string[] list = new string[] { "Address", "Bedrooms" };

                foreach (var apartment in ReadAll())
                {
                    if (t.Id == apartment.Id)
                    {
                        for (int i = 0; i < list.Length; i++)
                        {
                            apartment.GetType().GetProperty(list[i]).SetValue(apartment, t.GetType().GetProperty(list[i]).GetValue(t));
                        }
                    }
                }
            }
        }