public void UpdateBarrel(int id, BarrelCommand command) { var barrel = _repository.GetById(id); barrel.Update(command); _repository.UpdateBarrel(id, barrel); }
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; }
public void AddBarrel(BarrelCommand command) { var barrel = new Barrel(command); _repository.AddBarrel(barrel); }
public IActionResult Put(int id, [FromBody] BarrelCommand command) { _barrelService.UpdateBarrel(id, command); return(Ok()); }
public IActionResult Post([FromBody] BarrelCommand command) { _barrelService.AddBarrel(command); return(Ok()); }
public void Update(BarrelCommand command) { SetProperties(command); }
public Barrel(BarrelCommand command) { SetProperties(command); }