public void Create(CreateBookViewModel model) { if (!string.IsNullOrEmpty(model.Planet)) { var newBook = new FantasyBook() { Title = model.Title, Author = model.Author, Amount = model.Amount, NumberOfPages = model.NumberOfPages, Price = model.Price, Planet = model.Planet }; bookRepo.AddFantasy(newBook); } else if (!string.IsNullOrEmpty(model.Town)) { var newBook = new ClassicBook() { Title = model.Title, Author = model.Author, Amount = model.Amount, NumberOfPages = model.NumberOfPages, Price = model.Price, Town = model.Town }; bookRepo.AddClassic(newBook); } else { var newBook = new HistoryBook() { Title = model.Title, Author = model.Author, Amount = model.Amount, NumberOfPages = model.NumberOfPages, Price = model.Price, //Year = model.Year }; bookRepo.AddHistory(newBook); } }