Exemplo n.º 1
0
 public ActionResult Create(Blog.Entry model)
 {
     if (ModelState.IsValid)
     {
         model.CreatedDate = DateTime.Now;
         var binder = new CreateBlogToBlogPost();
         var entry = new BlogPost();
         binder.Load(model, entry);
         DataAccessLayer.Create<BlogPost>(entry);
         DataAccessLayer.DbContext.SaveChanges();
         return RedirectToAction("./Posts");
     }
     return View(model);
 }
Exemplo n.º 2
0
 public ActionResult Create(Blog.Entry model)
 {
     if (ModelState.IsValid)
     {
         model.CreatedDate = DateTime.Now;
         var binder = new CreateBlogToBlogPost();
         var entry  = new BlogPost();
         binder.Load(model, entry);
         DataAccessLayer.Create <BlogPost>(entry);
         DataAccessLayer.DbContext.SaveChanges();
         return(RedirectToAction("./Posts"));
     }
     return(View(model));
 }