Skip to content

Commit

Permalink
Home Page and Product Details Page UI has been done.
Browse files Browse the repository at this point in the history
  • Loading branch information
aliarmaganuygun committed Oct 14, 2024
1 parent a1ab9ed commit 5603e4c
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 9 deletions.
14 changes: 12 additions & 2 deletions BulkyWeb/Areas/Customer/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Collections;
using System.Diagnostics;
using BookBazaar.DataAccess.Repository.IRepository;
using BookBazaar.Models;
using Microsoft.AspNetCore.Mvc;

Expand All @@ -8,15 +10,23 @@ namespace BookBazaar.Areas.Customer.Controllers
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public readonly IUnitOfWork _unitOfWork;

public HomeController(ILogger<HomeController> logger)
public HomeController(ILogger<HomeController> logger, IUnitOfWork unitOfWork)
{
_logger = logger;
_unitOfWork = unitOfWork;
}

public IActionResult Index()
{
return View();
IEnumerable<Product> productList = _unitOfWork.Product.GetAll(includeProperties: "Category");
return View(productList);
}
public IActionResult Details(int productId)
{
Product product = _unitOfWork.Product.Get(p=> p.Id == productId,includeProperties: "Category");
return View(product);
}

public IActionResult Privacy()
Expand Down
100 changes: 100 additions & 0 deletions BulkyWeb/Areas/Customer/Views/Home/Details.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
@model Product

<form method="post">
<div class="card shadow border-0 mt-4 mb-4">
<div class="card-header bg-secondary bg-gradient text-light py-4">
<div class="row">
<div class="col-12 text-center">
<h3 class="text-white text-uppercase">@Model.Title</h3>
<p class="text-white-50 fw-semibold mb-0">by @Model.Author</p>
</div>
</div>
</div>
<div class="card-body">
<div class="py-3">
<div class="row">
<div class="col-6 col-md-2 offset-lg-1 pb-1">
<a asp-action="Index" class="btn btn-outline-primary bg-gradient mb-5 fw-semibold btn-sm text-uppercase">
<small>Back to home</small>
</a>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-3 offset-lg-1 text-center mb-3">
<img src="@Model.ImageUrl" style="width:100%" class="rounded" />
</div>
<div class="col-12 col-lg-6 offset-lg-1">

<div class="col-12 col-md-6 pb-4">
<span class="badge">@Model.Category.Name</span>
</div>
<div class="row ps-2">
<h6 class="text-dark text-opacity-50 ">ISBN : @Model.ISBN</h6>
</div>
<div class="row ps-2">
<h6 class="text-dark text-opacity-50 pb-2">
List Price:
<span class="text-decoration-line-through">
@Model.ListPrice.ToString("c")
</span>
</h6>
</div>
<div class="row text-center ps-2">
<div class="p-1 col-3 col-lg-2 bg-white border-bottom">
<div class="text-dark text-opacity-50 fw-semibold">Quantity</div>
</div>
<div class="p-1 col-3 col-lg-2 bg-white border-bottom">
<div class="text-dark text-opacity-50 fw-semibold">1-50</div>
</div>
<div class="p-1 col-3 col-lg-2 bg-white border-bottom">
<div class="text-dark text-opacity-50 fw-semibold">51-100</div>
</div>
<div class="p-1 col-3 col-lg-2 bg-white border-bottom">
<div class="text-dark text-opacity-50 fw-semibold">100+</div>
</div>
</div>
<div class="row text-center ps-2">
<div class="p-1 col-3 col-lg-2 bg-white text-warning fw-bold">
<div>Price</div>
</div>
<div class="p-1 col-3 col-lg-2 bg-white text-warning fw-bold">
<div>@Model.Price.ToString("c")</div>
</div>
<div class="p-1 col-3 col-lg-2 bg-white text-warning fw-bold">
<div>@Model.Price50.ToString("c")</div>
</div>
<div class="p-1 col-3 col-lg-2 bg-white text-warning fw-bold">
<div>@Model.Price100.ToString("c")</div>
</div>
</div>
<div class="row pl-2 my-3">
<p class="text-secondary lh-sm">@Html.Raw(Model.Description)</p>
</div>
<div class="row pl-2 mb-3">
<div class="col-md-4">
<div class="input-group mb-3">
<span class="input-group-text bg-primary text-white border-0 fw-semibold"
id="inputGroup-sizing-default">
Count
</span>
<input type="number" value="1" class="form-control text-end"
aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default" />

</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6 pb-1">
<button type="submit" disabled
class="btn btn-primary bg-gradient w-100 py-2 text-uppercase fw-semibold">
Add to Cart (Comming Soon...)
</button>
</div>
</div>
</div>

</div>
</div>
</div>
</div>
</form>
49 changes: 42 additions & 7 deletions BulkyWeb/Areas/Customer/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
@@ -1,8 +1,43 @@
@{
ViewData["Title"] = "Home Page";
}
@model IEnumerable<Product>

<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
<div class="row pb-3">
@foreach (var product in Model)
{
<div class="col-lg-3 col-sm-6">
<div class="row p-2">
<div class="col-12 p-1">
<div class="card border-0 p-3 shadow border-top border-5 rounded">
<img src="@product.ImageUrl" class="card-img-top rounded" />
<div class="pl-1">
<p class="card-title h5 text-dark opacity-75 text-uppercase text-center">@product.Title</p>
<p class="card-title text-warning text-center">by <b>@product.Author</b></p>
</div>
<div class="pl-1">
<p class="text-dark text-opacity-75 text-center mb-0">
List Price:
<span class="text-decoration-line-through">
@product.ListPrice.ToString("c")
</span>
</p>
</div>
<div class="pl-1">
<p class="text-dark text-opacity-75 text-center">
As Low as:
<span>
@product.Price100.ToString("c")
</span>
</p>
</div>
<div class="pl-1">
<a asp-action="Details"
asp-route-productId="@product.Id"
class="btn btn-primary bg-gradient border-0 form-control">
Details
</a>
</div>
</div>
</div>
</div>
</div>
}
</div>

0 comments on commit 5603e4c

Please sign in to comment.