public static CommentControl GetInstance() { if (_instance == null) { _instance = new CommentControl(); } return(_instance); }
private void SeedAds() { //TODO: Refactor var db = DbContextControl.GetNew(); if (db.Ads.Count() == 0) { if (db.Users.Count() == 0) { MigrationSeed.SeedUsers(); } MigrationSeed.SeedAds(); foreach (var ad in MigrationSeed.Ads) { PostAd(ad.Author.Email, ad.Title, ad.Content, ad.Location.Name, ad.Type); } var blueCar = MigrationSeed.Ads.FirstOrDefault(a => a.Title == "Selling blue sports car"); ReserveAd(blueCar?.Id, "*****@*****.**"); CommentControl.GetInstance().PostComment(blueCar.Id, "Interested!", "*****@*****.**"); } }
public IList <Comment> GetComments(int skip, int amount, string adId) { CommentControl comments = CommentControl.GetInstance(); return(comments.GetReplies(adId, skip, amount)); }