public UsageEntryViewModel(IMessageBroker messageBroker, IConsumableUsageService usageService,
            IHenHouseService houseService, IConsumableService consumableService,
            SaveUsageCommand saveUsageCommand, CancelCommand cancelCommand, ShowUsageCommand showListCommand
            )
        {
            this.messageBroker = messageBroker;
            this.usageService = usageService;
            this.houseService = houseService;
            this.consumableService = consumableService;

            this.saveUsageCommand = saveUsageCommand;
            this.showListCommand = showListCommand;

            CancelCommand = cancelCommand;

            PropertiesToValidate = new List<string>()
            {
                "Date",
                "Total",
                "Details"
            };

            InitializeCommands();

            HouseList = new ObservableCollection<HenHouse>(houseService.GetAll());
            ConsumableList = new ObservableCollection<Consumable>(consumableService.GetAll());

            SubscribeMessages();
        }
        public UsageEntryViewModel(IMessageBroker messageBroker, IConsumableUsageService usageService,
                                   IHenHouseService houseService, IConsumableService consumableService,
                                   SaveUsageCommand saveUsageCommand, CancelCommand cancelCommand, ShowUsageCommand showListCommand
                                   )
        {
            this.messageBroker     = messageBroker;
            this.usageService      = usageService;
            this.houseService      = houseService;
            this.consumableService = consumableService;

            this.saveUsageCommand = saveUsageCommand;
            this.showListCommand  = showListCommand;

            CancelCommand = cancelCommand;

            PropertiesToValidate = new List <string>()
            {
                "Date",
                "Total",
                "Details"
            };

            InitializeCommands();

            HouseList      = new ObservableCollection <HenHouse>(houseService.GetAll());
            ConsumableList = new ObservableCollection <Consumable>(consumableService.GetAll());

            SubscribeMessages();
        }
        void OnConsumableRefresh(object param)
        {
            var consumableList = consumableService.GetAll();

            Consumables            = new ObservableCollection <Consumable>(consumableList);
            DeleteCommand.EntityId = Guid.Empty;
        }
 public ActionResult <IEnumerable <Consumable> > Get()
 {
     return(Ok(consumableService.GetAll().Select(c => new ConsumableDTO(c)).ToList()));
 }