Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jean-Charles NEBOIT
ServiceWeb
Commits
a54fa552
Commit
a54fa552
authored
Mar 01, 2018
by
Clément
Browse files
Few Details
parent
671fce53
Changes
9
Hide whitespace changes
Inline
Side-by-side
Database/db.mdf
View file @
a54fa552
No preview for this file type
Database/db_log.ldf
View file @
a54fa552
No preview for this file type
MVC/Controllers/FightController.cs
View file @
a54fa552
...
...
@@ -36,9 +36,24 @@ namespace MVC.Controllers
}
// GET: Fght/Details/1
public
ActionResult
Details
(
int
id
)
public
async
Task
<
ActionResult
>
Details
(
int
id
)
{
return
View
();
FightModels
character
=
new
FightModels
();
IEnumerable
<
FightModels
>
relationships
=
new
List
<
FightModels
>();
using
(
var
client
=
new
HttpClient
())
{
client
.
BaseAddress
=
new
Uri
(
"http://localhost:13666/"
);
client
.
DefaultRequestHeaders
.
Accept
.
Clear
();
client
.
DefaultRequestHeaders
.
Accept
.
Add
(
new
MediaTypeWithQualityHeaderValue
(
"application/json"
));
HttpResponseMessage
response
=
await
client
.
GetAsync
(
"api/Fight/"
+
id
);
if
(
response
.
IsSuccessStatusCode
)
{
string
temp
=
await
response
.
Content
.
ReadAsStringAsync
();
character
=
JsonConvert
.
DeserializeObject
<
FightModels
>(
temp
);
}
}
return
View
(
character
);
}
// GET: Fght/Create
...
...
@@ -141,7 +156,26 @@ namespace MVC.Controllers
StringContent
content
=
new
StringContent
(
jsonString
,
System
.
Text
.
Encoding
.
UTF8
,
"application/json"
);
HttpResponseMessage
response
=
await
client
.
PostAsync
(
"api/fight"
,
content
);
}
return
RedirectToAction
(
"Index"
);
IEnumerable
<
FightModels
>
Fights
=
new
List
<
FightModels
>();
IEnumerable
<
FightModels
>
Fi
=
new
List
<
FightModels
>();
FightModels
F
=
new
FightModels
();
using
(
var
client
=
new
HttpClient
())
{
client
.
BaseAddress
=
new
Uri
(
"http://localhost:13666/"
);
client
.
DefaultRequestHeaders
.
Accept
.
Clear
();
client
.
DefaultRequestHeaders
.
Accept
.
Add
(
new
System
.
Net
.
Http
.
Headers
.
MediaTypeWithQualityHeaderValue
(
"application/json"
));
HttpResponseMessage
response
=
await
client
.
GetAsync
(
"api/Fight"
);
if
(
response
.
IsSuccessStatusCode
)
{
string
temp
=
await
response
.
Content
.
ReadAsStringAsync
();
Fights
=
JsonConvert
.
DeserializeObject
<
List
<
FightModels
>>(
temp
);
}
}
Fi
=
Fights
.
Where
(
c
=>
c
.
Name
.
Trim
()
==
fight
.
Name
).
ToList
();
F
=
Fi
.
First
();
return
RedirectToAction
(
"Details/"
+
F
.
ID
);
}
// GET: Fight/Edit/1
...
...
MVC/MVC.csproj
View file @
a54fa552
...
...
@@ -301,6 +301,7 @@
<Content
Include=
"Views\Territory\Edit.cshtml"
/>
<Content
Include=
"Views\Territory\Create.cshtml"
/>
<Content
Include=
"Views\Territory\Delete.cshtml"
/>
<Content
Include=
"Views\Fight\Details.cshtml"
/>
</ItemGroup>
<ItemGroup>
<Folder
Include=
"App_Data\"
/>
...
...
MVC/Views/Fight/Create.cshtml
View file @
a54fa552
...
...
@@ -49,11 +49,12 @@
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-md-offset-2 col-md-10"
>
<input
type=
"submit"
value=
"Create"
class=
"btn btn-default"
/>
<div
class=
"form-group"
>
<div
class=
"col-md-offset-2 col-md-10"
>
<input
type=
"submit"
value=
"Create"
class=
"btn btn-default"
/>
</div>
</div>
</div>
</div>
}
...
...
MVC/Views/Fight/Details.cshtml
0 → 100644
View file @
a54fa552
@model MVC.Models.FightModels
@{
ViewBag.Title = "Details";
}
<h2>
Details
</h2>
<div>
<h4>
FightModels
</h4>
<hr
/>
<dl
class=
"dl-horizontal"
>
<dt>
@Html.DisplayNameFor(model => model.Winner)
</dt>
<dd>
@Html.DisplayFor(model => model.Winner.Name)
</dd>
</dl>
</div>
<p>
@Html.ActionLink("Back to List", "Index")
</p>
MVC/Views/Fight/Index.cshtml
View file @
a54fa552
...
...
@@ -3,12 +3,12 @@
@{
ViewBag.Title = "All Fights";
}
<h
2>
@ViewBag.Title
</h2
>
<
p
>
@Html.ActionLink("Create New", "Create")
<
/p
>
<br
/><br
/>
<h
1
>
@Html.ActionLink("Jouer", "Create")
<
/h1
>
<br
/><br
/>
<
h4>
@ViewBag.Title
</h4
>
<table
class=
"table"
>
<tr>
<th>
...
...
MVC/Views/Home/Index.cshtml
View file @
a54fa552
...
...
@@ -3,29 +3,5 @@
}
<div
class=
"jumbotron"
>
<h1>
ASP.NET
</h1>
<p
class=
"lead"
>
ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.
</p>
<p><a
href=
"http://asp.net"
class=
"btn btn-primary btn-lg"
>
Learn more
»
</a></p>
</div>
<div
class=
"row"
>
<div
class=
"col-md-4"
>
<h2>
Getting started
</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a
class=
"btn btn-default"
href=
"http://go.microsoft.com/fwlink/?LinkId=301865"
>
Learn more
»
</a></p>
</div>
<div
class=
"col-md-4"
>
<h2>
Get more libraries
</h2>
<p>
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.
</p>
<p><a
class=
"btn btn-default"
href=
"http://go.microsoft.com/fwlink/?LinkId=301866"
>
Learn more
»
</a></p>
</div>
<div
class=
"col-md-4"
>
<h2>
Web Hosting
</h2>
<p>
You can easily find a web hosting company that offers the right mix of features and price for your applications.
</p>
<p><a
class=
"btn btn-default"
href=
"http://go.microsoft.com/fwlink/?LinkId=301867"
>
Learn more
»
</a></p>
</div>
<h1><a
href=
"http://localhost:5962/Fight"
class=
"btn btn-primary btn-lg"
>
Commencer
</a></h1>
</div>
\ No newline at end of file
WebApiGOT/Controllers/FightController.cs
View file @
a54fa552
...
...
@@ -17,7 +17,6 @@ namespace WebApiGOT.Controllers
{
List
<
FightDTO
>
list
=
new
List
<
FightDTO
>();
BusinessLayer
.
ThronesTournamentManager
busi
=
new
BusinessLayer
.
ThronesTournamentManager
();
foreach
(
EntitiesLayer
.
Fight
fight
in
busi
.
FightsList
())
{
list
.
Add
(
new
FightDTO
(
fight
));
...
...
@@ -29,7 +28,6 @@ namespace WebApiGOT.Controllers
public
FightDTO
Get
(
int
id
)
{
BusinessLayer
.
ThronesTournamentManager
busi
=
new
BusinessLayer
.
ThronesTournamentManager
();
return
new
FightDTO
(
busi
.
getFightById
(
id
));
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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