public ActionResult DetailBlog(int id) { BlogDao blogDao = new BlogDao(); Blog blog = blogDao.GetById(id); return(View(blog)); }
public void Create() { ResetDatabase(); AuthorDao authorDao = (AuthorDao)Container[typeof(AuthorDao)]; BlogDao blogDao = (BlogDao)Container[typeof(BlogDao)]; PostDao postDao = (PostDao)Container[typeof(PostDao)]; Author author = new Author("hamilton verissimo", "hammett", "mypass"); Blog blog = new Blog("hammett's blog", "my thoughts.. ugh!", "default", author); Post post = new Post("My first entry", "This is my first entry", DateTime.Now); post.Blog = blog; authorDao.Create(author); blogDao.Create(blog); postDao.Create(post); IList posts = postDao.Find(); Assert.AreEqual(1, posts.Count); Post comparisson = (Post)posts[0]; Assert.AreEqual(post.Title, comparisson.Title); Assert.AreEqual(post.Contents, comparisson.Contents); }
public ActionResult BlogMenu() { var BlogType = new BlogDao(); var model = BlogType.ListNameBlog(); return(PartialView(model)); }
public void FindBlogPosts() { ResetDatabase(); AuthorDao authorDao = (AuthorDao)Container[typeof(AuthorDao)]; BlogDao blogDao = (BlogDao)Container[typeof(BlogDao)]; Author author = new Author("hamilton verissimo", "hammett", "mypass"); Blog blog = new Blog("hammett's blog", "my thoughts.. ugh!", "default", author); authorDao.Create(author); blogDao.Create(blog); Post post1 = new Post("My first entry", "This is my first entry", DateTime.Now); post1.Blog = blog; Post post2 = new Post("My second entry", "This is my second entry", DateTime.Now); post2.Blog = blog; PostDao postDao = (PostDao)Container[typeof(PostDao)]; postDao.Create(post1); postDao.Create(post2); IList posts = postDao.Find(blog); Assert.AreEqual(2, posts.Count); }
/*********SEARCH*********/ public ActionResult Search(string phrase) { BlogDao blogDao = new BlogDao(); IList <Blog> blogs = blogDao.SearchBlogs(phrase); return(View("Index", blogs)); }
public MainForm(NewBlog newBlog, BlogDao blogDao, PostDao postDao) { InitializeComponent(); _newBlog = newBlog; _blogDao = blogDao; _postDao = postDao; }
// GET: Blog public ActionResult Index() { var blogDao = new BlogDao(); ViewBag.NewBlog = blogDao.ListBlog(5); return(View()); }
public ActionResult RenderSide() { /** * Render Side for Detail Index - Reicents Blogs */ int totalBlogs; BlogDao blogDao = new BlogDao(); IList <Blog> blogs = blogDao.GetBlogPaged(3, 1, out totalBlogs); return(View(blogs)); }
/*********SEARCH*********/ public ActionResult Search(string phrase) { BlogDao blogDao = new BlogDao(); IList <Blog> blogs = blogDao.SearchBlogs(phrase); KnihovnaUser user = new KnihovnaUserDao().GetByLogin(User.Identity.Name); if (user.Role.Identificator == "blogger" || user.Role.Identificator == "admin") { return(View("BlogEdited", blogs)); } return(View("Index", blogs)); }
public void CommonStatelessUsage() { container.Register(Component.For <BlogDao>().Named("blogdao")); BlogDao dao = container.Resolve <BlogDao>("blogdao"); dao.CreateBlog("my blog"); IList blogs = dao.ObtainBlogsStateless(); Assert.IsNotNull(blogs); Assert.AreEqual(1, blogs.Count); }
public void CommonUsage() { container.AddComponent("blogdao", typeof(BlogDao)); BlogDao dao = (BlogDao)container["blogdao"]; dao.CreateBlog("my blog"); IList blogs = dao.ObtainBlogs(); Assert.IsNotNull(blogs); Assert.AreEqual(1, blogs.Count); }
public ActionResult Index(int?pageBlog) { int itemsOnPageBlog = 9; int pgB = pageBlog.HasValue ? pageBlog.Value : 1; int totalBlogs; BlogDao blogDao = new BlogDao(); IList <Blog> blogs = blogDao.GetBlogPaged(itemsOnPageBlog, pgB, out totalBlogs); ViewBag.PagesBlog = (int)Math.Ceiling((double)totalBlogs / (double)itemsOnPageBlog); ViewBag.CurrentPageBlog = pgB; return(View(blogs)); }
public ActionResult UpdateBlog(Blog blog) { try { BlogDao blogDao = new BlogDao(); blogDao.Update(blog); TempData["message-success"] = "Blog " + blog.Header + " byl upraven"; } catch (Exception) { throw; } return(RedirectToAction("Index", "Blog")); }
public ActionResult AddBlog(Blog blog) { if (ModelState.IsValid) { BlogDao blogDao = new BlogDao(); blogDao.Create(blog); TempData["message-success"] = "Blog byl uspesne pridan"; } else { //vracam View Create sa svim podatcima koje je vec ispunio return(View("CreateBlog", blog)); } return(RedirectToAction("Index")); //presmerovani }
public void TestAddBlog() { BlogDao.Delete("0fd98278b1a549638556ca029b1dffe8"); BlogDao.Delete("3b5df9babcc64ec4a49599e10272c365"); var blog = new Blog(); blog.Summary = ""; blog.CreateTime = DateTime.Now; blog.ID = Guid.NewGuid().ToString("N"); BlogDao.Create(blog); blog.Summary = "<p> 直接抢劫了现成的模板,在网络上挖上一个专属自己的坑。</p>"; BlogDao.Update(blog); BlogDao.Delete(blog.ID); }
public void CreateAuthorAndBlog() { ResetDatabase(); AccountService service = (AccountService)Container[typeof(AccountService)]; Author author = new Author("hamilton verissimo", "hammett", "mypass"); Blog blog = new Blog("hammett's blog", "Description", "default", author); service.CreateAccountAndBlog(blog); AuthorDao dao = (AuthorDao)Container[typeof(AuthorDao)]; Assert.AreEqual(1, dao.Find().Count); BlogDao blogdao = (BlogDao)Container[typeof(BlogDao)]; Assert.AreEqual(1, blogdao.Find().Count); }
public ActionResult DeleteBlog(int id) { try { BlogDao blogDao = new BlogDao(); Blog blog = blogDao.GetById(id); blogDao.Delete(blog); TempData["message-success"] = "Blog " + blog.Header + " byl smazan"; } catch (Exception e) { throw; } return(RedirectToAction("Index")); }
public void FindAll() { ResetDatabase(); AuthorDao authorDao = (AuthorDao)Container[typeof(AuthorDao)]; BlogDao blogDao = (BlogDao)Container[typeof(BlogDao)]; Author author = new Author("hamilton verissimo", "hammett", "mypass"); Blog blog1 = new Blog("hammett's blog", "my thoughts.. ugh!", "default", author); Blog blog2 = new Blog("hammett's personal blog", "more thoughts.. ugh!", "default", author); authorDao.Create(author); blogDao.Create(blog1); blogDao.Create(blog2); IList blogs = blogDao.Find(); Assert.AreEqual(2, blogs.Count); }
public ActionResult Index(int?pageBlog) { int itemsOnPageBlog = 9; int pgB = pageBlog.HasValue ? pageBlog.Value : 1; int totalBlogs; BlogDao blogDao = new BlogDao(); IList <Blog> blogs = blogDao.GetBlogPaged(itemsOnPageBlog, pgB, out totalBlogs); ViewBag.PagesBlog = (int)Math.Ceiling((double)totalBlogs / (double)itemsOnPageBlog); ViewBag.CurrentPageBlog = pgB; KnihovnaUser user = new KnihovnaUserDao().GetByLogin(User.Identity.Name); if (user.Role.Identificator == "blogger" || user.Role.Identificator == "admin") { return(View("BlogEdited", blogs)); } return(View(blogs)); }
public void Create() { ResetDatabase(); AuthorDao authorDao = (AuthorDao)Container[typeof(AuthorDao)]; BlogDao blogDao = (BlogDao)Container[typeof(BlogDao)]; Author author = new Author("hamilton verissimo", "hammett", "mypass"); Blog blog = new Blog("hammett's blog", "my thoughts.. ugh!", "default", author); authorDao.Create(author); blogDao.Create(blog); IList blogs = blogDao.Find(); Assert.AreEqual(1, blogs.Count); Blog comparisson = (Blog)blogs[0]; Assert.AreEqual(blog.Name, comparisson.Name); Assert.AreEqual(blog.Description, comparisson.Description); Assert.AreEqual(blog.Theme, comparisson.Theme); }
public BlogCRUDService(IUnitOfWork unitOfWork) : base(unitOfWork) { _blogDao = new BlogDao(unitOfWork); }
public BlogService(AuthorDao authorDao, BlogDao blogDao, PostDao postDao) { _authorDao = authorDao; _blogDao = blogDao; _postDao = postDao; }
public BlogImpl() { _blogDao = new BlogDao(); }
public ReadOnlyTransactionsService(ISessionManager sessionManager, BlogDao dao) { this.dao = dao; this.sessionManager = sessionManager; }
public static void AddBlog(Blog blog) { BlogDao.Create(blog); }
public static void UpdateBlog(Blog blog) { BlogDao.Update(blog); }
public BlogControllerCreatorSubscriber(BlogDao blogDao, ControllerTree controllerTree) { _blogDao = blogDao; _controllerTree = controllerTree; }
public static void DeleteBloe(string id) { BlogDao.Delete(id); }
public static Blog GetBlog(string id) { return(BlogDao.GetBlog(id)); }
public static List <Blog> GetBlogs() { return(BlogDao.GetAllBlogs()); }
public NewBlog(BlogDao blogDao) { InitializeComponent(); _blogDao = blogDao; }