Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IoTSharp
IoTSharp
提交
60702480
IoTSharp
项目概览
IoTSharp
/
IoTSharp
9 个月 前同步成功
通知
15
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
IoTSharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
60702480
编写于
6月 03, 2019
作者:
麦壳饼
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
创建设备的时候使用DevicePostDto来进行单独创建, 而不是Device类,另外, 增加
上级
49cdf663
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
12 deletion
+38
-12
IoTSharp.Test/IoTSharp.Test.csproj
IoTSharp.Test/IoTSharp.Test.csproj
+1
-1
IoTSharp/Controllers/DevicesController.cs
IoTSharp/Controllers/DevicesController.cs
+9
-9
IoTSharp/Dtos/DevicePostDto.cs
IoTSharp/Dtos/DevicePostDto.cs
+14
-0
IoTSharp/IoTSharp.csproj
IoTSharp/IoTSharp.csproj
+2
-2
README.md
README.md
+12
-0
未找到文件。
IoTSharp.Test/IoTSharp.Test.csproj
浏览文件 @
60702480
...
...
@@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.
0
" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.
1
" />
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
</ItemGroup>
...
...
IoTSharp/Controllers/DevicesController.cs
浏览文件 @
60702480
...
...
@@ -185,21 +185,21 @@ namespace IoTSharp.Controllers
// POST: api/Devices
[
Authorize
(
Roles
=
nameof
(
UserRole
.
CustomerAdmin
))]
[
HttpPost
]
public
async
Task
<
ActionResult
<
Device
>>
PostDevice
(
Device
device
)
public
async
Task
<
ActionResult
<
Device
>>
PostDevice
(
Device
PostDto
device
)
{
var
cid
=
User
.
Claims
.
First
(
c
=>
c
.
Type
==
IoTSharpClaimTypes
.
Customer
);
var
tid
=
User
.
Claims
.
First
(
c
=>
c
.
Type
==
IoTSharpClaimTypes
.
Tenant
);
dev
ic
e
.
Tenant
=
_context
.
Tenant
.
Find
(
new
Guid
(
tid
.
Value
));
dev
ic
e
.
Customer
=
_context
.
Customer
.
Find
(
new
Guid
(
cid
.
Value
));
if
(
dev
ice
.
Tenant
==
null
||
devic
e
.
Customer
==
null
)
var
devvalue
=
new
Device
()
{
Name
=
device
.
Name
,
DeviceType
=
device
.
DeviceType
};
dev
valu
e
.
Tenant
=
_context
.
Tenant
.
Find
(
new
Guid
(
tid
.
Value
));
dev
valu
e
.
Customer
=
_context
.
Customer
.
Find
(
new
Guid
(
cid
.
Value
));
if
(
dev
value
.
Tenant
==
null
||
devvalu
e
.
Customer
==
null
)
{
return
NotFound
(
new
ApiResult
<
Device
>(
ApiCode
.
NotFoundTenantOrCustomer
,
$"Not found Tenant or Customer "
,
device
));
return
NotFound
(
new
ApiResult
<
Device
PostDto
>(
ApiCode
.
NotFoundTenantOrCustomer
,
$"Not found Tenant or Customer "
,
device
));
}
_context
.
Device
.
Add
(
dev
ic
e
);
_context
.
AfterCreateDevice
(
dev
ic
e
);
_context
.
Device
.
Add
(
dev
valu
e
);
_context
.
AfterCreateDevice
(
dev
valu
e
);
await
_context
.
SaveChangesAsync
();
return
await
GetDevice
(
dev
ic
e
.
Id
);
return
await
GetDevice
(
dev
valu
e
.
Id
);
}
// DELETE: api/Devices/5
...
...
IoTSharp/Dtos/DevicePostDto.cs
0 → 100644
浏览文件 @
60702480
using
IoTSharp.Data
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
IoTSharp.Dtos
{
public
class
DevicePostDto
{
public
string
Name
{
get
;
set
;
}
public
DeviceType
DeviceType
{
get
;
set
;
}
}
}
IoTSharp/IoTSharp.csproj
浏览文件 @
60702480
...
...
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeIdentifiers>win7-x64;rhel.7-x64;ubuntu.1
6
.04-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>win7-x64;rhel.7-x64;ubuntu.1
8
.04-x64</RuntimeIdentifiers>
<PreserveCompilationContext>true</PreserveCompilationContext>
<CreateUser>true</CreateUser>
<InstallService>true</InstallService>
...
...
@@ -79,7 +79,7 @@
<PackageReference Include="MQTTnet.Extensions.Rpc" Version="3.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" />
<PackageReference Include="NSwag.AspNetCore" Version="12.3.1" />
<PackageReference Include="QuartzHostedService" Version="0.0.
4
" />
<PackageReference Include="QuartzHostedService" Version="0.0.
5
" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
</ItemGroup>
<ProjectExtensions>
...
...
README.md
浏览文件 @
60702480
...
...
@@ -25,3 +25,15 @@ IoTSharp is an open-source IoT platform for data collection, processing, visuali
![
IotSharp Logo
](
docs/images/iot_sharp_logo.png
)
## How to install ?
-
mkdir /var/lib/iotsharp/
-
cp ./
*
/var/lib/iotsharp/
-
chmod 777 /var/lib/iotsharp/IoTSharp
-
cp iotsharp.service /etc/systemd/system/iotsharp.service
-
sudo systemctl enable /etc/systemd/system/iotsharp.service
-
sudo systemctl start iotsharp.service
-
sudo journalctl -fu iotsharp.service
-
http://127.0.0.1:80/
-
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录