public async Task AddFermentabuoy(FermentabuoyDto dto)
 {
     Fermentabuoy entity = new Fermentabuoy()
     {
         DeviceId     = dto.DeviceId,
         DeviceNumber = dto.DeviceNumber,
         MacAddress   = dto.MacAddress,
         CreatedBy    = dto.CreatedBy,
         Created      = DateTime.Now
     };
     await FermentabuoyDataProvider.AddFermentabuoy(entity);
 }
        public async Task <IActionResult> Put(FermentabuoyDto dto)
        {
            try
            {
                await FermentabuoyService.UpdateFermentabuoy(dto);

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex));
            }
        }
        public async Task <IActionResult> Get(int id)
        {
            try
            {
                FermentabuoyDto fermentabouy = await FermentabuoyService.GetFermentabuoy(id);

                return(Ok(fermentabouy));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex));
            }
        }
        public async Task <FermentabuoyDto> GetFermentabuoy(int id)
        {
            Fermentabuoy entity = await FermentabuoyDataProvider.GetFermentabuoy(id);

            FermentabuoyDto dto = new FermentabuoyDto()
            {
                DeviceId     = entity.DeviceId,
                DeviceNumber = entity.DeviceNumber,
                MacAddress   = entity.MacAddress,
                Created      = entity.Created,
                CreatedBy    = entity.CreatedBy
            };

            return(dto);
        }
        public async Task <List <FermentabuoyDto> > GetAllFermentabuoys()
        {
            List <FermentabuoyDto> dtos     = new List <FermentabuoyDto>();
            List <Fermentabuoy>    entities = await FermentabuoyDataProvider.GetAllFermentabuoys();

            foreach (var entity in entities)
            {
                FermentabuoyDto dto = new FermentabuoyDto()
                {
                    DeviceId     = entity.DeviceId,
                    DeviceNumber = entity.DeviceNumber,
                    MacAddress   = entity.MacAddress,
                    Created      = entity.Created,
                    CreatedBy    = entity.CreatedBy
                };
                dtos.Add(dto);
            }
            return(dtos);
        }