Exemplo n.º 1
0
 public void InsertLocation(Location location)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Locations.Add(location);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void DeleteProperty(Property property)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Properties.Attach(property);
         ctx.Properties.Remove(property);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void DeleteAppointment(Appointment appointment)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Appointments.Attach(appointment);
         ctx.Appointments.Remove(appointment);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void DeleteLocation(Location loc)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Locations.Attach(loc);
         ctx.Locations.Remove(loc);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public void DeleteUser(User user)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Users.Attach(user);
         ctx.Users.Remove(user);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public void DeleteBuyer(Buyer buyer)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Buyers.Attach(buyer);
         ctx.Buyers.Remove(buyer);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public void DeleteSeller(Seller seller)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Sellers.Attach(seller);
         ctx.Sellers.Remove(seller);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 8
0
 public void InsertAppointment(Appointment appointment, Buyer buyer, Seller seller)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Appointments.Add(appointment);
         if (buyer != null)
         {
             ctx.Buyers.Attach(buyer);
             appointment.Buyer = buyer;
         }
         if (seller != null)
         {
             ctx.Sellers.Attach(seller);
             appointment.Seller = seller;
         }
         ctx.SaveChanges();
     }
 }
Exemplo n.º 9
0
 public void UpdateUser(User user, List<Appointment> appointments, string name, string address, string zipCode, string phone, string mobil, string email, string misc)
 {
     user.Name = name;
     user.Appointments = appointments;
     user.Address = address;
     user.ZipCode = zipCode;
     user.Phone = phone;
     user.Mobile = mobil;
     user.Email = email;
     user.Misc = misc;
     using (var ctx = new SystemContext())
     {
         ctx.Entry(user).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemplo n.º 10
0
 public void UpdateBuyer(Buyer buyer)
 {
     //Fire up a new DB context
     using (var ctx = new SystemContext())
     {
         //Match buyer from input with buyer to update from database
         Buyer dbBuyer = ctx.Buyers.Find(buyer.Id);
         //Set the values of the dbBuyer to the values of the buyer from input
         ctx.Entry(dbBuyer).CurrentValues.SetValues(buyer);
         //Save the changes back to the database.
         ctx.SaveChanges();
     }
 }
Exemplo n.º 11
0
 public void UpdateBuyer(Buyer buyer, List<Property> properties, string name, string address, string zipCode, string phone, string mobile, string email, string misc, string estateType, double minPrice, double maxPrice,
     double lotSizeMin, double lotSizeMax, double probertySizeMin, double probertySizeMax, double desiredRoomsMin, double desiredRoomsMax, List<Location> locations, string otherPref, Boolean contactAllowedByBoligOne,
     Boolean contactAllowedByReal, Boolean allowedEmailSpam, Boolean inRKI, Boolean buyerApproved, string bank, Boolean ownesHouse, Boolean livesForRent)
 {
     buyer.Name = name;
     buyer.Properties = properties;
     buyer.Address = address;
     buyer.ZipCode = zipCode;
     buyer.Phone = phone;
     buyer.Mobile = mobile;
     buyer.Email = email;
     buyer.Misc = misc;
     buyer.EstateType = estateType;
     buyer.MinPrice = minPrice;
     buyer.MaxPrice = maxPrice;
     buyer.LotSizeMin = lotSizeMin;
     buyer.LotSizeMax = lotSizeMax;
     buyer.ProbertySizeMin = probertySizeMin;
     buyer.ProbertySizeMax = probertySizeMax;
     buyer.DesiredRoomsMin = desiredRoomsMin;
     buyer.DesiredRoomsMax = desiredRoomsMax;
     buyer.Locations = locations;
     buyer.OtherPref = otherPref;
     buyer.ContactAllowedByBoligOne = contactAllowedByBoligOne;
     buyer.ContactAllowedByReal = contactAllowedByReal;
     buyer.AllowedEmailSpam = allowedEmailSpam;
     buyer.InRKI = inRKI;
     buyer.BuyerApproved = buyerApproved;
     buyer.Bank = bank;
     buyer.OwnesHouse = ownesHouse;
     buyer.LivesForRent = livesForRent;
     using (var ctx = new SystemContext())
     {
         ctx.Entry(buyer).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemplo n.º 12
0
 public void InsertBuyer(Buyer buyer)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Buyers.Add(buyer);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 13
0
 public void UpdateLocation(Location loc, string zipCode, string city)
 {
     loc.ZipCode = zipCode;
     loc.City = city;
     using (var ctx = new SystemContext())
     {
         ctx.Entry(loc).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemplo n.º 14
0
        public void UpdateSeller(Seller seller, List<Property> properties, string name, string address, string zipCode, string phone, string mobil, string email, string misc)
        {
            using (var ctx = new SystemContext())
            {
                Seller s = ctx.Sellers.Where(x => x.Id == seller.Id).SingleOrDefault();
                s.Name = name;
                s.Properties = properties;
                s.Address = address;
                s.ZipCode = zipCode;
                s.Phone = phone;
                s.Mobile = mobil;
                s.Email = email;
                s.Misc = misc;

                ctx.Entry(s).State = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
            }
        }
Exemplo n.º 15
0
 public void UpdateProperty(Property property, string address, string zipCode, string type, int rooms, int floors, double price,
     double propertySize, double houseSize, int constructionYear)
 {
     using (var ctx = new SystemContext())
     {
         Property p = ctx.Properties.Where(x => x.Id == property.Id).SingleOrDefault();
         p.Address = address;
         p.ZipCode = zipCode;
         p.Type = type;
         p.Rooms = rooms;
         p.Floors = floors;
         p.Price = price;
         p.PropertySize = propertySize;
         p.HouseSize = houseSize;
         p.ConstructionYear = constructionYear;
         ctx.Entry(p).State = System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemplo n.º 16
0
 public void InsertUser(User user)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Users.Add(user);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 17
0
 public void InsertSeller(Seller seller)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Sellers.Add(seller);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 18
0
 public void UpdateSeller(Seller seller)
 {
     using (var ctx = new SystemContext())
     {
         Seller dbSeller = ctx.Sellers.Find(seller.Id);
         ctx.Entry(dbSeller).CurrentValues.SetValues(seller);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 19
0
        public void UpdateAppointment(Appointment appointment, DateTime date, DateTime StartTime, DateTime EndTime,
            string category, string descricption, string status)
        {
            appointment.Date = date;
            appointment.StarTime = StartTime;
            appointment.EndTime = EndTime;
            appointment.Category = category;
            appointment.Description = descricption;
            appointment.Status = status;

            using (var ctx = new SystemContext())
            {
                ctx.Entry(appointment).State = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
            }
        }
Exemplo n.º 20
0
 public void InsertProperty(Property property)
 {
     using (var ctx = new SystemContext())
     {
         ctx.Properties.Add(property);
         ctx.SaveChanges();
     }
 }