Commit a54fa552 authored by Clément's avatar Clément
Browse files

Few Details

parent 671fce53
No preview for this file type
No preview for this file type
......@@ -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
......
......@@ -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\" />
......
......@@ -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>
}
......
@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>
......@@ -3,12 +3,12 @@
@{
ViewBag.Title = "All Fights";
}
<h2>@ViewBag.Title</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<br /><br />
<h1>
@Html.ActionLink("Jouer", "Create")
</h1>
<br /><br />
<h4>@ViewBag.Title</h4>
<table class="table">
<tr>
<th>
......
......@@ -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 &raquo;</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 &raquo;</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 &raquo;</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 &raquo;</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
......@@ -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));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment