Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
99f4df54
Commit
99f4df54
authored
Mar 27, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hospital/disabled-- 启用/禁用医院
parent
44697277
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletions
+31
-1
performance/Performance.Api/Controllers/HospitalController.cs
+11
-1
performance/Performance.DtoModels/Request/HospitalRequest.cs
+6
-0
performance/Performance.Services/HospitalService.cs
+14
-0
No files found.
performance/Performance.Api/Controllers/HospitalController.cs
View file @
99f4df54
...
...
@@ -47,7 +47,8 @@ public ApiResponse<HospitalResponse> Update([CustomizeValidator(RuleSet = "Updat
var
hospital
=
_hospitalService
.
Update
(
request
);
return
new
ApiResponse
<
HospitalResponse
>(
ResponseType
.
OK
,
hospital
);
}
[
Disable
]
[
Route
(
"delete"
)]
[
HttpPost
]
public
ApiResponse
Delete
([
CustomizeValidator
(
RuleSet
=
"Delete"
),
FromBody
]
HospitalRequest
request
)
...
...
@@ -56,5 +57,14 @@ public ApiResponse Delete([CustomizeValidator(RuleSet = "Delete"), FromBody]Hosp
return
new
ApiResponse
(
ResponseType
.
Fail
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
[
Route
(
"disabled"
)]
[
HttpPost
]
public
ApiResponse
Disabled
([
CustomizeValidator
(
RuleSet
=
"Disable"
),
FromBody
]
HospitalRequest
request
)
{
if
(!
_hospitalService
.
Disabled
(
request
))
return
new
ApiResponse
(
ResponseType
.
Fail
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
}
performance/Performance.DtoModels/Request/HospitalRequest.cs
View file @
99f4df54
...
...
@@ -65,6 +65,12 @@ public HospitalRequestValidator()
{
RuleFor
(
x
=>
x
.
ID
).
NotNull
().
GreaterThan
(
0
);
});
RuleSet
(
"Disable"
,
()
=>
{
RuleFor
(
x
=>
x
.
ID
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
States
).
NotNull
().
InclusiveBetween
(
1
,
2
);
});
}
}
}
performance/Performance.Services/HospitalService.cs
View file @
99f4df54
...
...
@@ -118,5 +118,19 @@ public bool Delete(HospitalRequest request)
return
_hospitalRepository
.
Remove
(
hospital
);
}
/// <summary>
/// 启用/禁用医院
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
bool
Disabled
(
HospitalRequest
request
)
{
var
hospital
=
_hospitalRepository
.
GetEntity
(
t
=>
t
.
ID
==
request
.
ID
);
if
(
null
==
hospital
)
throw
new
PerformanceException
(
$"医院不存在 ID:
{
request
.
ID
}
"
);
hospital
.
States
=
request
.
States
;
return
_hospitalRepository
.
Update
(
hospital
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment