public static bool UpdateProperty(Property pd) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { Property p = db.Properties.Find(pd.PropertyID); p.OwnerID = pd.OwnerID; p.CityID = pd.CityID; p.StreetID = pd.StreetID; p.Number = pd.Number; p.Size = pd.Size; p.Floor = pd.Floor; p.IsDivided = pd.IsDivided; p.ManagmentPayment = pd.ManagmentPayment; p.IsPaid = pd.IsPaid; p.IsExclusivity = pd.IsExclusivity; p.ExclusivityID = pd.ExclusivityID; p.IsWarranty = pd.IsWarranty; p.IsRented = pd.IsRented; p.RoomsNum = pd.RoomsNum; p.ApartmentNum = pd.ApartmentNum; db.SaveChanges(); return(true); } return(false); }
public static bool AddUserDocuments(Document doc) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { db.Documents.Add(doc); db.SaveChanges(); return(true); } return(false); }
public static bool AddExclusivityPerson(Exclusivity e) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { db.Exclusivitys.Add(e); db.SaveChanges(); return(true); } return(false); }
public static int AddUser(User u) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { u.status = true; db.Users.Add(u); db.SaveChanges(); return(db.Users.Max(i => i.UserID)); } return(0); }
public static int AddRental(Rental r) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { r.status = true; db.Rentals.Add(r); db.SaveChanges(); return(db.Rentals.Max(i => i.RentalID)); } return(0); }
public static bool DeleteUserDocuments(Document doc) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { Document d = db.Documents.Find(doc.DocID); db.Documents.Remove(d); db.SaveChanges(); return(true); } return(false); }
public static int AddSubProperty(SubProperty sp) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { sp.status = true; db.SubProperties.Add(sp); db.SaveChanges(); return(db.SubProperties.Max(i => i.SubPropertyID)); } return(0); }
public static bool AddCity(City c) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { c.CityId = db.Cities.Count() + 1; db.Cities.Add(c); db.SaveChanges(); return(true); } return(false); }
public static bool DeleteProperty(int id) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { Property p = db.Properties.Find(id); p.status = false; db.SaveChanges(); return(true); } return(false); }
public static bool AddStreet(Street s) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { s.StreetID = db.Streets.Count() + 1; db.Streets.Add(s); db.SaveChanges(); return(true); } return(false); }
public static int AddPropertyOwner(PropertiesOwner po) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { po.status = true; db.PropertiesOwners.Add(po); db.SaveChanges(); return(db.PropertiesOwners.Max(i => i.OwnerID)); //return (from p in db.PropertiesOwners where p.OwnerFirstName==po.OwnerFirstName && p.OwnerLastName==po.OwnerLastName && p.Phone==po.Phone && p.Email==po.Email select p.OwnerID).FirstOrDefault(); } return(0); }
public static int AddTask(Task t) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { //t.DateForHandling = new DateTime(t.DateForHandling.Year, t.DateForHandling.Month, t.DateForHandling.Day, 0, 0, 0); t.status = true; db.Tasks.Add(t); db.SaveChanges(); return(db.Tasks.Max(i => i.TaskID)); } return(0); }
public static int AddProperty(Property pe) { using (ArgamanExpressEntities db = new ArgamanExpressEntities()) { db.Properties.Add(pe); db.SaveChanges(); return(db.Properties.Max(i => i.PropertyID)); } return(0); }