private byte[] RetrieveImageFromDatabase(OfferName on) { OfferName offerName = _context.offerNames .FirstOrDefault(q => q.Name == "DefaultImage"); byte[] image = on.Image ?? offerName.Image; return(image); }
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); }
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); }
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); } }
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); } }