Ejemplo n.º 1
0
        public GatewayDetailDto FindByIdWithDeviceInfo(int id)
        {
            var entity = _gatewayRepo.FindById(id, i => i.Devices);

            if (entity == null)
            {
                return new GatewayDetailDto
                       {
                           StatusCode    = HttpStatusCode.NotFound,
                           StatusMessage = "Gateway not found"
                       }
            }
            ;

            var dto = Mapper.Map <Gateway, GatewayDetailDto>(entity);

            dto.StatusCode    = HttpStatusCode.OK;
            dto.StatusMessage = "Gateway retrieved successfully";
            return(dto);
        }
    }