public Task Handle(TerminalCategoryCreatedEvent @event)
        {
            var createdTerminalCategory = new TerminalCategory
            {
                TerminalId       = @event.TerminalCategory.TerminalId,
                TicketCategoryId = @event.TerminalCategory.TicketCategoryId,
            };

            _unitOfWork.TerminalCategories.Create(createdTerminalCategory);
            return(Task.CompletedTask);
        }
Ejemplo n.º 2
0
        public Task Handle(TerminalCategoryCreatedEvent @event)
        {
            var createdTerminalCategory = new TerminalCategory
            {
                TerminalId       = @event.TerminalCategory.TerminalId,
                TicketCategoryId = @event.TerminalCategory.TicketCategoryId,
            };

            _unitOfWork.TerminalCategories.Create(createdTerminalCategory);
            _hub.Clients.All.SendAsync("terminal-category-created-event", createdTerminalCategory);
            return(Task.CompletedTask);
        }
        public ActionResult <TerminalCategory> RemoveCategoryFromTerminal([FromBody] TerminalCategory terminalCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                _unitOfWork.Terminals.DeleteTerminalCategory(terminalCategory);

                var deleteTerminalCategory = new DeleteTerminalCategoryCommand(terminalCategory);
                _unitOfWork.SourceEvent(deleteTerminalCategory);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Ok(terminalCategory));
        }
 public TerminalCategoryDeletedEvent(TerminalCategory terminalCategory)
 {
     TerminalCategory = terminalCategory;
 }
 public void DeleteTerminalCategory(TerminalCategory terminalCategory)
 {
     _settingsContext.TerminalCategories.Remove(terminalCategory);
     _settingsContext.SaveChanges();
 }
 public void CreateTerminalCategory(TerminalCategory terminalCategory)
 {
     _settingsContext.TerminalCategories.Add(terminalCategory);
     _settingsContext.SaveChanges();
 }
Ejemplo n.º 7
0
 public DeleteTerminalCategoryCommand(TerminalCategory terminalCategory)
 {
     TerminalCategory = terminalCategory;
 }
 public TerminalCategoryCreatedEvent(TerminalCategory terminalCategory)
 {
     TerminalCategory = terminalCategory;
 }
 public CreateTerminalCategoryCommand(TerminalCategory terminalCategory)
 {
     TerminalCategory = terminalCategory;
 }