Пример #1
0
 private void HandleBookUpdatedEvent(BookUpdatedEvent e)
 {
     this.Title       = e.Title;
     this.Author      = e.Author;
     this.Description = e.Description;
     this.ISBN        = e.ISBN;
     this.Pages       = e.Pages;
     this.Inventory   = e.Inventory;
 }
        public bool Handle(BookUpdatedEvent message)
        {
            string updateBookSql = @"UPDATE [Books] SET 
[Title]=@title, [Author]=@author, [Description]=@description, [ISBN]=@isbn, [Pages]=@pages, [Inventory]=@inventory
 WHERE [AggregateRootId]=@aggregateRootId";
            var    rowsAffected  = SqlHelper.ExecuteNonQuery(QueryDBConnectionString, CommandType.Text, updateBookSql,
                                                             new SqlParameter("@title", message.Title),
                                                             new SqlParameter("@author", message.Author),
                                                             new SqlParameter("@description", message.Description),
                                                             new SqlParameter("@isbn", message.ISBN),
                                                             new SqlParameter("@pages", message.Pages),
                                                             new SqlParameter("@inventory", message.Inventory),
                                                             new SqlParameter("@aggregateRootId", message.AggregateRootId));

            return(rowsAffected > 0);
        }
Пример #3
0
 public void Handle(BookUpdatedEvent message)
 {
     BroadcastResourceChange(ModelAction.Updated, MapToResource(message.Book, true));
 }