public void contactDetails(BookModel bookModel) { if (!bookRepo.GetBookByName(bookModel.bookName, bookModel.bookType)) { bookRepo.AddBook(bookModel); } ContactModel contactModel = new ContactModel(); Console.WriteLine("Enter First Name:"); contactModel.firstName = Console.ReadLine(); Console.WriteLine("Enter Last Name"); contactModel.lastName = Console.ReadLine(); Console.WriteLine("Enter Address"); contactModel.address = Console.ReadLine(); Console.WriteLine("Enter City"); contactModel.city = Console.ReadLine(); Console.WriteLine("Enter State"); contactModel.state = Console.ReadLine(); Console.WriteLine("Enter zip"); contactModel.zip = Console.ReadLine(); Console.WriteLine("Enter Phone Number"); contactModel.phoneNumber = Console.ReadLine(); Console.WriteLine("Enter Email"); contactModel.email = Console.ReadLine(); if (contactRepo.AddContact(contactModel, bookModel)) { Console.WriteLine("Records added successfully"); } }
public async void AddBook(BookInputModel book) { var bookEntity = new Book { Title = book.Title, Isbn = book.Isbn, PublishingYear = book.PublishingYear ?? default(int), Type = book.Type, Price = book.Price ?? default(double), PublisherId = book.PublisherId ?? default(int) }; var bookId = _bookRepo.AddBook(bookEntity); var details = new BookDetails { BookId = bookId, Description = book.Description, Font = book.Font, PageCount = book.PageCount ?? default(int), Length = book.Length ?? default(int) }; _bookRepo.AddBookDetails(details); foreach (var id in book.Author) { var AuthorConnection = new BookAuthorConnection { BookId = bookId, AuthorId = id }; _bookRepo.AddBookAuthorConnection(AuthorConnection); } foreach (var id in book.Genre) { var GenreConnection = new BookGenreConnection { BookId = bookId, GenreId = id }; _bookRepo.AddBookGenreConnection(GenreConnection); } using (var memoryStream = new MemoryStream()) { await book.CoverImage.CopyToAsync(memoryStream); var img = new CoverImage { BookId = bookId, Img = memoryStream.ToArray() }; _bookRepo.AddImage(img); } }
private void btnInsert_Click(object sender, EventArgs e) { Book book = new Book(); book.Title = txtTitle.Text; book.Author = txtAuthor.Text; book.Price = decimal.Parse(txtPrice.Text); book.Description = txtDescription.Text; book.CountryId = (int)CmbxCountry.SelectedValue; BookRepo repo = new BookRepo(); repo.AddBook(book); }
private void btnInsert_Click(object sender, EventArgs e) { Book book = new Book { Title = txtTitle.Text, Author = txtAuthor.Text, Price = decimal.Parse(txtPrice.Text), Description = txtDescription.Text, CountryId = 1 }; repo.AddBook(book); LoadBooks(); }
public IActionResult Create(string title, int year, double rating, int author, string isbn, int category, string coverImage) { var NewBook = new Book { Title = title, ReleaseYear = year, Rating = rating, AuthorId = author, Isbn = isbn, CategoryId = category, CoverImg = coverImage }; _bookRepo.AddBook(NewBook); return(RedirectToAction("Index", "Create")); }
private void btnInsert_Click(object sender, EventArgs e) { var book = new Book { Title = txtTitle.Text, Author = txtAuthor.Text, Price = decimal.Parse(txtPrice.Text), Description = txtDescription.Text, CountryId = (int)cmbCountry.SelectedValue }; BookRepo repo = new BookRepo(); repo.AddBook(book); }
public void AddBook(BookInputModel model) { var book = new Book { Title = model.Title, Author = model.Author, ReleaseYear = model.ReleaseYear, Genre = model.Genre, ISBN = model.ISBN, Price = model.Price, Stock = model.Stock, TopSeller = model.TopSeller, OnSale = model.OnSale, Discount = model.Discount, Image = model.Image, }; _bookRepo.AddBook(book); }
public IActionResult Add(BookVM book) { if (ModelState.IsValid && book.image != null) { // this class contains the function that handles the files FileHandling fileHandling = new FileHandling(_webHostEnvironment); String imagePath = fileHandling.fileUpload(book.image, "books"); book.books.image_path = imagePath; _bookrepo.AddBook(book.books); return(RedirectToAction("Table", book)); } else { book.fileError = "Please Upload a Image"; book.genreList = _genreRepo.GetAllGenres(); book.authorList = _authorRepo.GetAllAuthors(); return(View("AddForm", book)); } }
public void AddBook(BookInputModel bookInputModel) { //returns new book var book = new Book { ISBN = bookInputModel.ISBN, Language = bookInputModel.Language, Image = bookInputModel.Image, Title = bookInputModel.Title, Genre = bookInputModel.Genre, Info = bookInputModel.Info, AuthorId = (int)bookInputModel.AuthorId, Publisher = bookInputModel.Publisher, PageCount = bookInputModel.PageCount, ReleaseYear = (int)bookInputModel.ReleaseYear, Price = (double)bookInputModel.Price, Discount = 0, Rating = 0, RatingCount = 0, Stock = 10 }; _bookRepo.AddBook(book); }
public void AddBook(InputBookModel book) { _bookRepo.AddBook(book); }
public void AddBook(BookInputModel model) { _bookRepo.AddBook(model); }
public void AddBook(BookInputModel newBook) { _bookRepo.AddBook(newBook); }