Пример #1
0
        public async Task <IActionResult> Get(int?id = null)
        {
            if (!id.HasValue)
            {
                var allDevices = await devicesRepository.GetAllAsync();

                return(Ok(allDevices));
            }
            else
            {
                var findDevice = await devicesRepository.FindByIdAsync(id.Value);

                if (findDevice == null)
                {
                    return(NotFound("This device does not exist!"));
                }

                return(Ok(findDevice));
            }
        }