public ActionResult Index(string title) { if (title == null) { title = "This is my first title"; } using (var ctx = new EFContext()) { var post = ctx.Posts.Where(p => p.Title == title).FirstOrDefault(); var postModel = new PostModel(post.Title, post.Body, post.DateCreated); var commentModel = new Collection <string>(); if (post.Comments != null && post.Comments.Any()) { foreach (var item in post.Comments) { commentModel.Add(item.Body); } } var dao = new MongoDAO(); var mPost = dao.LoadPost(title); return(View(new ArticleModel(postModel, commentModel))); } //var readers = new NewDataReaders(); //return View(readers.GetArticleModel(title)); }
public static IDataAccess ResolveDataAccess() { var isMongo = bool.Parse(ConfigurationManager.AppSettings["isMongo"]); if (isMongo) { dataAccess = new MongoDAO(); } else { dataAccess = new DataAccess.DataAccess(); } return(dataAccess); }
public BebidaService(IConfiguration config) { bebidaDAO = new MongoDAO <Bebida>(config, "CatalogoDb", "Bebidas"); }