Ejemplo n.º 1
0
        public void UpdateUser(string name, string surname, string email)
        {
            var oldUser = new UserRecord(this.IsBanned, this.Name, this.Surname, this.Email);

            this.Name    = name;
            this.Surname = surname;
            this.Email   = email;
            var updatedUser = new UserRecord(this.IsBanned, name, surname, email);

            AddEvent(new UserUpdated(oldUser, updatedUser));
        }
Ejemplo n.º 2
0
 private LibraryRecord(LibraryRecordId id, UserRecord user, List <BookRecord> books)
 {
     Id = id;
     if (user.IsNotBanned)
     {
         User = user;
     }
     else
     {
         throw new InvalidEntityStateException();
     }
     this.CreatedDate = DateTime.UtcNow;
     this.ReturnFine  = new ReturnFine(0);
     Books            = books;
     foreach (var book in books)
     {
         AddEvent(new BookAddedToLibraryRecord(book.BookId, id, book.BookAmount.Amount));
     }
 }
Ejemplo n.º 3
0
        public static LibraryRecord Create(UserRecord user, List <BookRecord> books)
        {
            var record = new LibraryRecord(TypedId.GetNewId <LibraryRecordId>(), user, books);

            return(record);
        }