public Entities.Property ReadProperty(int ID)
 {
     using (var database = new EstateBrokerContext())
     {
         Entities.Property tempProperty = (Entities.Property)PropertyFactory.CreateProperty(database.Properties.FirstOrDefault(a => a.CaseID == ID));
         return(tempProperty);
     }
 }
        public PrintObject GetDataForPrint(int caseId)
        {
            PrintObject printObject = new PrintObject();
            CalculateAverageWithIntegerInput calc = new CalculateAverageWithIntegerInput(_caseCRUD);

            Entities.Case workingCase = _caseCRUD.ReadCase(caseId);

            Entities.Realtor workingRealtor = _realtorCRUD.ReadRealtor(_caseCRUD.ReturnRealtorIDOnCase(caseId));

            Entities.Property workingProperty = _propertyCRUD.ReadPropertyFromCaseID(caseId);

            Entities.Address workingAddress = _addressCRUD.ReadAddress(workingProperty.PostalCode, workingProperty.AddressLine1);

            printObject.RealtorName  = workingRealtor.Name;
            printObject.RealtorPhone = workingRealtor.PhoneNR;

            printObject.CaseID       = workingCase.CaseID;
            printObject.CreationDate = workingCase.CreationDate;
            if (workingCase.ClosedDate != null)
            {
                printObject.ClosedDate = (DateTime)workingCase.ClosedDate;
            }
            printObject.Price = workingCase.Price;

            printObject.PostalCode     = workingProperty.PostalCode;
            printObject.AddressLine1   = workingProperty.AddressLine1;
            printObject.EstimatedPrice = workingProperty.EstimatedPrice;


            printObject.AddressLine2 = workingAddress.AddressLine2;
            printObject.ExteriorArea = workingAddress.ExteriorArea;
            printObject.InteriorArea = workingAddress.InteriorArea;
            printObject.BuildYear    = workingAddress.BuildYear;

            printObject.AverageAreaPrice = calc.Calculate(workingProperty.PostalCode);

            return(printObject);
        }