Пример #1
0
 public ActionResult Index(ModelBook model)
 {
     if (ModelState.IsValid)
     {
         Book book = new Book(model.Name, model.PublishingDate, model.PageCount, model.ISBN);
         foreach (string VARIABLE in model.SelectedCheck)
         {
             Author FindAuthor = singleton.GetAuthors.BackAuthor(Convert.ToInt32(VARIABLE));
             book.AddBookAuthor(FindAuthor);
         }
         Publisher pub = singleton.GetPublisher.Find(Publisher => Publisher.Id == Convert.ToInt32(model.RadioCheck));
         book.AddBookPublisher(pub);
         singleton.AddBook(book);
         ViewBag.Book = singleton.GetBooks;
         return(RedirectToAction("Show_Table"));
     }
     else
     {
         Show_RadioAndCeck();
         return(View());
     }
 }