Exemplo n.º 1
0
 public ActionResult Add(FormCollection form)
 {
     sbartoszak_bookwormsEntities ent = new sbartoszak_bookwormsEntities();
     Review review = new Review();
     if (TryUpdateModel(review))
     {
         review.CreateDate = DateTime.Now;
         ent.Reviews.AddObject(review);
         ent.SaveChanges();
     }
     return RedirectToAction("Details", "Book", new { id = review.IdBook });
 }
Exemplo n.º 2
0
 public ActionResult Add(FormCollection form)
 {
     sbartoszak_bookwormsEntities ent = new sbartoszak_bookwormsEntities();
     ViewBag.BookGenres = ent.Genres.OrderBy(g => g.Name).ToSelectListItem(1, g => g.IdGenre, g => g.Name, g => g.Name, g => g.IdGenre.ToString());
     Book book = new Book();
     if (TryUpdateModel(book))
     {
         book.AddDate = DateTime.Now;
         ent.Books.AddObject(book);
         ent.SaveChanges();
     }
     return RedirectToAction("Index");
 }