Ejemplo n.º 1
0
 public Entities.Case ReadCase(int ID)
 {
     using (var database = new EstateBrokerContext())
     {
         return((Entities.Case)CaseFactory.CreateCase(database.Cases.Find(ID)));
     }
 }
Ejemplo n.º 2
0
        public List <Entities.Case> ReadAllCases()
        {
            List <Entities.Case> caseList = new List <Entities.Case>();

            using (var database = new EstateBrokerContext())
            {
                foreach (var Case in database.Cases)
                {
                    caseList.Add((Entities.Case)CaseFactory.CreateCase(Case));
                }
                return(caseList);
            }
        }
Ejemplo n.º 3
0
        public List <Entities.Case> ReadAPreDefinedNumberOfCasesWithNoRealtor(int number)
        {
            List <Entities.Case> caseList = new List <Entities.Case>();

            using (var database = new EstateBrokerContext())
            {
                foreach (var Case in database.Cases)
                {
                    if (Case.RealtorID == 1 && caseList.Count != number)
                    {
                        caseList.Add((Entities.Case)CaseFactory.CreateCase(Case));
                    }
                }
                return(caseList);
            }
        }
Ejemplo n.º 4
0
        public List <Entities.Case> ReadCasesInPostalCode(int postalCode)
        {
            using (var database = new EstateBrokerContext())
            {
                List <Entities.Case>     cases      = new List <Entities.Case>();
                List <Database.Property> properties = new List <Database.Property>();

                if (database.Properties.Any(s => s.PostalCode == postalCode) == true)
                {
                    properties = database.Properties.Where(s => s.PostalCode == postalCode).ToList();
                }

                foreach (var item in properties)
                {
                    cases.Add((Entities.Case)CaseFactory.CreateCase(database.Cases.Find(item.CaseID)));
                }

                database.SaveChanges();

                return(cases);
            }
        }