public void Update(PublisherDto publisherDto) { var pub = _publisherRepository.FindBy(publisherDto.Id); pub.Update(publisherDto.Name, publisherDto.WebSite, publisherDto.Email); _publisherRepository.Update(pub); }
public static PublisherDto MapToPublisherDto(Publisher publisher) { var publisherDto = new PublisherDto(); publisherDto.Id = publisher.EntityIdentityKey; publisherDto.Name = publisher.Name; publisherDto.OfficeAddress = publisher.Office.ToString(); publisherDto.WebSite = publisher.WebSite; publisherDto.Email = publisher.Email; publisherDto.Books = new List <BookDto>(); foreach (var book in publisher.Books) { publisherDto.Books.Add(new BookDto() { Id = Convert.ToString(book.BookId), Title = book.title }); } return(publisherDto); }
public void Remove(PublisherDto publisher) { var pub = _publisherRepository.FindBy(publisher.Id); _publisherRepository.Remove(pub); }
public void Add(PublisherDto publisher) { var pub = Publisher.Add(publisher.Name, publisher.WebSite, publisher.Email, new Address("", "", "", "", ""), new List <Book>()); _publisherRepository.Add(pub); }