コード例 #1
0
        private byte[] RetrieveImageFromDatabase(OfferName on)
        {
            OfferName offerName = _context.offerNames
                                  .FirstOrDefault(q => q.Name == "DefaultImage");

            byte[] image = on.Image ?? offerName.Image;
            return(image);
        }
コード例 #2
0
        private string ReturnAirConditioningType(OfferName ON)
        {
            bool   HaveCarsManual    = ON.CarVersions.Any(o => o.AirConditioningType.ToString() == "manual");
            bool   HaveCarsAutomatic = ON.CarVersions.Any(o => o.AirConditioningType.ToString() == "automatic");
            string answer            = HaveCarsManual ? "manual" : "automatic";

            answer = (HaveCarsManual && HaveCarsAutomatic) ? "manual / automatic" : answer;
            return(answer);
        }
コード例 #3
0
        private string ReturnTransmissionType(OfferName ON)
        {
            bool   HaveCarsManual    = ON.CarVersions.Any(o => o.TransmissionType.ToString() == "manual");
            bool   HaveCarsAutomatic = ON.CarVersions.Any(o => o.TransmissionType.ToString() == "automatic");
            string answer            = HaveCarsAutomatic ? "automatic" : (HaveCarsManual ? "manual" : null);

            answer = (HaveCarsManual && HaveCarsAutomatic) ? "manual / automatic" : answer;
            return(answer);
        }
コード例 #4
0
 private string ReturnExamplePrice(OfferName on)
 {
     try
     {
         decimal exPrice = on.Pricelists.Min(o => o.BasePricePerDay);
         return(string.Format("From {0}zł per day", exPrice));
     }
     catch
     {
         return(null);
     }
 }
コード例 #5
0
        private string ReturnRangeOfPassengersForSpecifiedOfferName(OfferName ON)
        {
            try
            {
                int?   MaxNoOfPaseengers = ON.CarVersions.Max(o => o.Passengers);
                int?   MinNoOfPassengers = ON.CarVersions.Min(o => o.Passengers);
                string answer            = MaxNoOfPaseengers == MinNoOfPassengers?MaxNoOfPaseengers.ToString() : string.Format("{0}-{1}", MinNoOfPassengers, MaxNoOfPaseengers);

                return(answer);
            }
            catch
            {
                return(null);
            }
        }