Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
stormwild committed Feb 10, 2015
1 parent b293e7e commit 384bb74
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
11 changes: 6 additions & 5 deletions BCSHotels/Views/Home/Details.cshtml
Expand Up @@ -14,9 +14,11 @@
@foreach (var img in Model.Images)
{
<div class="col-sm-6 col-md-4">
<img src="@img.Path" alt="@img.Name">
<div class="caption">
<p>@img.Name</p>
<div class="thumbnail">
<img src="@img.Path" alt="@img.Name">
<div class="caption">
<p>@img.Name</p>
</div>
</div>
</div>
}
Expand All @@ -43,7 +45,6 @@
</div>


<p>
@Html.ActionLink("Edit", "Edit", new { id = Model.Id }) |
<p>
@Html.ActionLink("Back to List", "Index")
</p>
1 change: 1 addition & 0 deletions BCSHotels/Views/Home/Index.cshtml
Expand Up @@ -30,6 +30,7 @@
<div class="caption">
<h3>@hotel.Name</h3>
<p>@hotel.Description</p>
<p>Price: @hotel.Price Rating: @hotel.Rating</p>
<p><a href="@Url.Action("Details", new { id = hotel.Id })" class="btn btn-primary" role="button">Book Now</a></p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion BCSHotels/Views/Home/List.cshtml
Expand Up @@ -40,7 +40,7 @@
<td>
@Html.DisplayFor(modelItem => item.Rating)
</td>
<td>
<td class="text-hide">
@Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
@Html.ActionLink("Details", "Details", new { id=item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Id })
Expand Down
4 changes: 3 additions & 1 deletion BCSHotelsDomain/BCSHotelsDomain.csproj
Expand Up @@ -56,7 +56,9 @@
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Migrations\Sql\workfile.sql" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
21 changes: 17 additions & 4 deletions BCSHotelsDomain/Migrations/Configuration.cs
Expand Up @@ -30,7 +30,7 @@ protected override void Seed(BCSHotelsDomain.Peristence.BCSContext context)
// );
//

/*var r = new Random();
var r = new Random();
var hotels = new List<Hotel>();

for (var i = 0; i < 100; i++)
Expand All @@ -44,7 +44,10 @@ protected override void Seed(BCSHotelsDomain.Peristence.BCSContext context)
});
}

hotels.ForEach(h => context.Hotels.AddOrUpdate(h));*/
if (!context.Hotels.Any())
{
hotels.ForEach(h => context.Hotels.AddOrUpdate(h));
}

var images = new List<Image>();

Expand All @@ -56,10 +59,20 @@ protected override void Seed(BCSHotelsDomain.Peristence.BCSContext context)
Path = "http://lorempixel.com/400/200/city/" + hotel.Name + "/",
HotelId = hotel.Id
});
}

images.ForEach(img => context.Images.AddOrUpdate(img));
images.Add(new Image
{
Name = "Image 2 for " + hotel.Name,
Path = "http://lorempixel.com/400/200/city/" + hotel.Name + "/",
HotelId = hotel.Id
});
}

if (!context.Images.Any())
{
images.ForEach(img => context.Images.AddOrUpdate(img));
}

}
}
}

0 comments on commit 384bb74

Please sign in to comment.