private void InitData() { if (!publishers.IsInit) { publishers.Create(new Publisher() { Name = "publisher1" }); publishers.Create(new Publisher() { Name = "publisher2" }); publishers.IsInit = true; } if (!authors.IsInit) { authors.Create(new Author() { Name = "author1", DateOfBirth = new DateTime(1966, 08, 15), DateOfDeath = null }); authors.Create(new Author() { Name = "author2", DateOfBirth = new DateTime(1947, 11, 21), DateOfDeath = new DateTime(2006, 10, 5) }); authors.IsInit = true; } if (!books.IsInit) { books.Create(new Book() { Name = "Book1", Publisher = publishers.Get(1), Author = new List <Author>() { authors.Get(1) }, PublishDate = new DateTime(2010, 10, 1), PageCount = 187, ISBN = "ISBN 5-02-013850-9" }); books.Create(new Book() { Name = "Book2", Publisher = publishers.Get(1), Author = new List <Author>() { authors.Get(1), authors.Get(2) }, PublishDate = new DateTime(2011, 05, 20), PageCount = 256, ISBN = "ISBN 4-13-019790-7" }); books.IsInit = true; } }
public ActionResult Create(Publisher publisher) { publishers.Create(publisher); return(RedirectToAction("List")); }