Exemple #1
0
        public void UpdateBarrel(int id, BarrelCommand command)
        {
            var barrel = _repository.GetById(id);

            barrel.Update(command);

            _repository.UpdateBarrel(id, barrel);
        }
Exemple #2
0
        private void SetProperties(BarrelCommand command)
        {
            if (string.IsNullOrEmpty(command.Name))
            {
                throw new Exception("Name cannot be empty");
            }

            Name            = command.Name;
            Type            = command.Type;
            Capacity        = command.Capacity;
            CurrentCapacity = command.CurrentCapacity;
            WineId          = command.WineId;
        }
Exemple #3
0
        public void AddBarrel(BarrelCommand command)
        {
            var barrel = new Barrel(command);

            _repository.AddBarrel(barrel);
        }
Exemple #4
0
        public IActionResult Put(int id, [FromBody] BarrelCommand command)
        {
            _barrelService.UpdateBarrel(id, command);

            return(Ok());
        }
Exemple #5
0
        public IActionResult Post([FromBody] BarrelCommand command)
        {
            _barrelService.AddBarrel(command);

            return(Ok());
        }
Exemple #6
0
 public void Update(BarrelCommand command)
 {
     SetProperties(command);
 }
Exemple #7
0
 public Barrel(BarrelCommand command)
 {
     SetProperties(command);
 }