Exemplo n.º 1
0
        public AreaModel UpdateArea(int id, [FromBody] AreaModel area)
        {
            var returnedArea = _areaRepository.Update(id, area.Name, area.Type,
                                                      area.Humidity, area.Temperature, area.Volume);

            return(AreaModel.FromArea(returnedArea, _estimator.Calculate(returnedArea)));
        }
Exemplo n.º 2
0
        public AreaModel AddArea([FromBody] AreaModel area)
        {
            if (area.Rectangle == null)
            {
                throw new ArgumentException();
            }
            var id        = _areaRepository.Add(area.Rectangle, area.Type, area.Name);
            var foundArea = _areaRepository.FindById(id);

            return(AreaModel.FromArea(foundArea, _estimator.Calculate(foundArea)));
        }
Exemplo n.º 3
0
 public IEnumerable <AreaModel> Areas()
 {
     return(_areaRepository.FindAll().ToList()
            .Select(area => AreaModel.FromArea(area, _estimator.Calculate(area))));
 }