コード例 #1
0
ファイル: DALDeviceMapper.cs プロジェクト: codenesium/samples
        public virtual ApiDeviceServerResponseModel MapEntityToModel(
            Device item)
        {
            var model = new ApiDeviceServerResponseModel();

            model.SetProperties(item.Id,
                                item.DateOfLastPing,
                                item.IsActive,
                                item.Name,
                                item.PublicId);

            return(model);
        }
コード例 #2
0
        public virtual ApiDeviceServerResponseModel MapServerRequestToResponse(
            int id,
            ApiDeviceServerRequestModel request)
        {
            var response = new ApiDeviceServerResponseModel();

            response.SetProperties(id,
                                   request.DateOfLastPing,
                                   request.IsActive,
                                   request.Name,
                                   request.PublicId);
            return(response);
        }
コード例 #3
0
        public virtual ApiDeviceActionServerResponseModel MapEntityToModel(
            DeviceAction item)
        {
            var model = new ApiDeviceActionServerResponseModel();

            model.SetProperties(item.Id,
                                item.Action,
                                item.DeviceId,
                                item.Name);
            if (item.DeviceIdNavigation != null)
            {
                var deviceIdModel = new ApiDeviceServerResponseModel();
                deviceIdModel.SetProperties(
                    item.DeviceIdNavigation.Id,
                    item.DeviceIdNavigation.DateOfLastPing,
                    item.DeviceIdNavigation.IsActive,
                    item.DeviceIdNavigation.Name,
                    item.DeviceIdNavigation.PublicId);

                model.SetDeviceIdNavigation(deviceIdModel);
            }

            return(model);
        }