Beispiel #1
0
        public ICommandResult Handle(DeleteMachineCommand command)
        {
            try
            {
                _uow.GetRepository <Machine>().Delete(command.MachineId);

                _uow.SaveChanges();

                return(new CommandResult(success: true, message: "Máquina removida com sucesso", data: command));
            }
            catch (Exception ex)
            {
                return(new CommandResult(success: false, message: ex.Message, data: null));
            }
        }
Beispiel #2
0
        public ICommandResult DeleteMachine(Guid machineId)
        {
            var command = new DeleteMachineCommand {
                MachineId = machineId
            };

            command.Validate();

            if (!command.Valid)
            {
                return(new CommandResult(success: false, message: null, data: command.Notifications));
            }

            return(_handler.Handle(command));
        }
Beispiel #3
0
        public ServicesVM()
        {
            NewPrintShopCommand      = new NewPrintShopCommand(this);
            NewMachineCommand        = new NewMachineCommand(this);
            NewServiceCommand        = new NewServiceCommand(this);
            DeletePrintShopCommand   = new DeletePrintShopCommand(this);
            DeleteMachineCommand     = new DeleteMachineCommand(this);
            DeleteServiceCommand     = new DeleteServiceCommand(this);
            SelectedPrintShopCommand = new SelectedPrintShopCommand(this);
            ExitCommand = new ExitCommand(this);

            PrintShops = new ObservableCollection <PrintShop>();
            Services   = new ObservableCollection <Service>();
            Machines   = new ObservableCollection <Machine>();

            ReadPrintShops();
            ReadMachines();
            ReadServices();
        }