Exemplo n.º 1
0
        /// <summary>
        /// 图书馆接收归还的书
        /// </summary>
        /// <param name="book"></param>
        /// <param name="account"></param>
        /// <param name="count"></param>
        public void ReceiveBook(Book book, LibraryAccount account, int count)
        {
            var bookStoreItem = _bookStoreItems.SingleOrDefault(x => x.BookId == book.Id);

            OnEventHappened(new BookReceived(Id, book.Id, account.Id, count));
            OnAggregateRootCreated(new HandlingEvent(book, account, this, HandlingType.Return));
        }
Exemplo n.º 2
0
 public LibraryAccount Create(string number, string owner)
 {
     using (var context = _contextManager.GetContext())
     {
         var account = new LibraryAccount(number, owner);
         context.Add(account);
         context.SaveChanges();
         return(account);
     }
 }
Exemplo n.º 3
0
 public HandlingEvent(Book book, LibraryAccount account, Library library, HandlingType handlingType) : base(Guid.NewGuid())
 {
     OnEventHappened(new HandlingEventCreated(Id, book.Id, account.Id, library.Id, handlingType, DateTime.Now));
 }