public AdCreateModel(BaseAd ad) : this() { Body = ad.Body; IsOffer = ad.IsOffer; Price = ad.Price; if (ad.Category != null) SelectedCategoryId = ad.Category.Id; if (ad.City != null) { SelectedCityId = ad.City.Id; SelectedProvinceId = ad.City.Province.Id; } Telephone = ad.PhoneNumber; Title = ad.Title; if (ad.CreatedBy != null) { Email = ad.CreatedBy.Email; Name = ad.CreatedBy.Firstname; } // Create the ImageIds list based on the images of the Ad StringBuilder sb = new StringBuilder(); ad.Images.ToList().ForEach(x => sb.AppendFormat("{0};", x.Id.ToString())); ImageIds = sb.ToString(); }
public AdDetailsModel(BaseAd ad) : this() { AdId = ad.Id; Title = ad.Title; Location = ad.City.Label; Price = String.Format(CultureInfo.GetCultureInfo("fr-FR"), "{0:0,0 Francs}", ad.Price); CreationDateString = String.Format(CultureInfo.GetCultureInfo("fr-FR"), "{0:f}", ad.CreationDate); Body = ad.Body; if (ad.Category != null) { Category = ad.Category.Label; CategoryUrlPart = ad.Category.LabelUrlPart; CategoryGroup = ad.Category.ParentCategory.Label; CategoryGroupUrlPart = ad.Category.ParentCategory.LabelUrlPart; } UserFirstName = ad.CreatedBy.Firstname; UserPhoneNumber = ad.PhoneNumber; ad.Images.ToList().ForEach(i => ImagesIds.Add(i.Id.ToString())); }
//Add the Ad to the category and set the Ad category to this public virtual void AddAd(BaseAd adToBeAdded) { this.Ads.Add(adToBeAdded); adToBeAdded.Category = this; }
public virtual void AddAd(BaseAd ad) { this.Ads.Add(ad); ad.City = this; }
public void SendActivationEmail(BaseAd ad) { IDictionary<String, String> data = new Dictionary<String, String>(); data.Add("name", ad.CreatedBy.Firstname); data.Add("title", ad.Title); data.Add("id", ad.Id.ToString()); data.Add("activationToken", ad.ActivationToken); data.Add("websiteAddress", _appSettingsProvider.WebsiteAddress); data.Add("websiteName", _appSettingsProvider.WebsiteName); String subject = String.Format("BEA Activez votre annonce \"{0}\"", ad.Title); String body = _templatingService.GetTemplatedDocument("ActivationEmail.vm", data); _emailService.SendEmail(subject, body, ad.CreatedBy.Email, "*****@*****.**"); }
public SpamAdRequest(BaseAd ad) { this.Ad = ad; }