public void Update(BookEntity bookEntity) { BookEntity savedEntity = FindById(bookEntity.Id); savedEntity.Id = bookEntity.Id; savedEntity.ISBN = bookEntity.ISBN; savedEntity.Name = bookEntity.Name; savedEntity.Price = bookEntity.Price; savedEntity.AuthorId = bookEntity.AuthorId; savedEntity.CategoryId = bookEntity.CategoryId; }
private BookEntity Clone(BookEntity bookEntity) { BookEntity newEntity = new BookEntity(); newEntity.Id = bookEntity.Id; newEntity.ISBN = bookEntity.ISBN; newEntity.Name = bookEntity.Name; newEntity.Price = bookEntity.Price; newEntity.AuthorId = bookEntity.AuthorId; newEntity.CategoryId = bookEntity.CategoryId; return newEntity; }
public void Create(BookSaveDto bookDto) { var bookEntity = new BookEntity { Id = bookDto.Id, AuthorId = bookDto.AuthorId, CategoryId = bookDto.CategoryId, ISBN = bookDto.ISBN, Name = bookDto.Name, Price = bookDto.Price }; this.bookRepository.Create(bookEntity); }
public void Delete(BookEntity bookEntity) { BookEntity savedEntity = FindById(bookEntity.Id); bookList.Remove(savedEntity); }
public void Create(BookEntity bookEntity) { var newBook = Clone(bookEntity); newBook.Id = bookList.Count; bookList.Add(newBook); }