From f54252fabd8405b3ad4e81caabca0fcc3dee863e Mon Sep 17 00:00:00 2001 From: ngocy007 Date: Sun, 5 Jun 2022 21:55:45 +0700 Subject: [PATCH 1/2] 50% cart --- ShopTC/Controllers/Cart.cs | 20 ++++++++++++++ ShopTC/Controllers/GioHangController.cs | 34 ++++++++++++++++++++++++ ShopTC/Controllers/ThuCungsController.cs | 3 ++- ShopTC/ShopTC.csproj | 4 +++ ShopTC/Views/Shared/_LayoutAdmin.cshtml | 6 ++++- ShopTC/Views/ThuCungs/Create.cshtml | 3 --- ShopTC/Views/ThuCungs/Edit.cshtml | 3 --- ShopTC/Views/ThuCungs/Index2.cshtml | 12 ++++++++- 8 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 ShopTC/Controllers/Cart.cs create mode 100644 ShopTC/Controllers/GioHangController.cs diff --git a/ShopTC/Controllers/Cart.cs b/ShopTC/Controllers/Cart.cs new file mode 100644 index 0000000..be33800 --- /dev/null +++ b/ShopTC/Controllers/Cart.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace ShopTC.Controllers +{ + public class Cart + { + string name, photo, price, quantity; + + public Cart(string name, string photo, string price, string quantity) + { + this.name = name; + this.photo = photo; + this.price = price; + this.quantity = quantity; + } + } +} \ No newline at end of file diff --git a/ShopTC/Controllers/GioHangController.cs b/ShopTC/Controllers/GioHangController.cs new file mode 100644 index 0000000..1606f4e --- /dev/null +++ b/ShopTC/Controllers/GioHangController.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace ShopTC.Controllers +{ + public class GioHangController : Controller + { + // GET: GioHang + private const string CartSession = "CartSesion"; + public ActionResult Index() + { + return View(); + } + + public ActionResult AddToCart(string id) + { + Session[CartSession] = "alo"; + + if (Session[CartSession] == null) + { + + } + else + { + + } + + return View(); + } + } +} \ No newline at end of file diff --git a/ShopTC/Controllers/ThuCungsController.cs b/ShopTC/Controllers/ThuCungsController.cs index e277965..a62e128 100644 --- a/ShopTC/Controllers/ThuCungsController.cs +++ b/ShopTC/Controllers/ThuCungsController.cs @@ -33,7 +33,8 @@ public ActionResult Index() public ActionResult Index2() { - return View(); + + return View(db.ThuCung.ToList()); } // GET: ThuCungs/Details/5 diff --git a/ShopTC/ShopTC.csproj b/ShopTC/ShopTC.csproj index 50fa1f3..2c33b8c 100644 --- a/ShopTC/ShopTC.csproj +++ b/ShopTC/ShopTC.csproj @@ -129,7 +129,9 @@ + + Global.asax @@ -239,6 +241,8 @@ + + diff --git a/ShopTC/Views/Shared/_LayoutAdmin.cshtml b/ShopTC/Views/Shared/_LayoutAdmin.cshtml index 9aba104..3acfb74 100644 --- a/ShopTC/Views/Shared/_LayoutAdmin.cshtml +++ b/ShopTC/Views/Shared/_LayoutAdmin.cshtml @@ -37,9 +37,13 @@ { @Html.ActionLink("ĐĂNG NHẬP", "../DangNhap/DangNhap", new { @class = "a" }) } + else + { + @Html.ActionLink("Thú Cưng Admin", "../ThuCungs/Index", new { @class = "a" }) + } }  |  - @Html.ActionLink("Thú Cưng", "../ThuCungs/Index", new { @class = "a" }) |  + @Html.ActionLink("Thú Cưng", "../ThuCungs/Index2", new { @class = "a" }) |  @Html.ActionLink("Thống kê", "../ThongKe/Index", new { @class = "a" })

@ViewBag.NguoiDung


diff --git a/ShopTC/Views/ThuCungs/Create.cshtml b/ShopTC/Views/ThuCungs/Create.cshtml index 32419ef..c778b4e 100644 --- a/ShopTC/Views/ThuCungs/Create.cshtml +++ b/ShopTC/Views/ThuCungs/Create.cshtml @@ -110,6 +110,3 @@ @Html.ActionLink("Back to List", "Index") -@section Scripts { - @Scripts.Render("~/bundles/jqueryval") -} diff --git a/ShopTC/Views/ThuCungs/Edit.cshtml b/ShopTC/Views/ThuCungs/Edit.cshtml index 97ecbab..6331b37 100644 --- a/ShopTC/Views/ThuCungs/Edit.cshtml +++ b/ShopTC/Views/ThuCungs/Edit.cshtml @@ -104,6 +104,3 @@ @Html.ActionLink("Back to List", "Index") -@section Scripts { - @Scripts.Render("~/bundles/jqueryval") -} diff --git a/ShopTC/Views/ThuCungs/Index2.cshtml b/ShopTC/Views/ThuCungs/Index2.cshtml index bdb6f8c..0a350f2 100644 --- a/ShopTC/Views/ThuCungs/Index2.cshtml +++ b/ShopTC/Views/ThuCungs/Index2.cshtml @@ -4,5 +4,15 @@ Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; } -

Index2

+
+ @foreach (var item in Model) + { +
+ Alternate Text +

@item.TenTC

+

@item.GiaTC

+ @Html.ActionLink("Thêm Giỏ Hàng", "AddToCart", "GioHang", new { id = item.MaTC }) +
+ } +
From db10712dc52e896b2fb5705d672b919b338ee5c5 Mon Sep 17 00:00:00 2001 From: ngocy007 Date: Mon, 6 Jun 2022 16:30:17 +0700 Subject: [PATCH 2/2] push 80% thieu 1 2 cai thong ke --- ShopTC/Controllers/Cart.cs | 6 +- ShopTC/Controllers/DangNhapController.cs | 78 +-------- ShopTC/Controllers/GioHangController.cs | 206 ++++++++++++++++++++++- ShopTC/Controllers/ThongKeController.cs | 107 ++++++++++++ ShopTC/Controllers/ThuCungsController.cs | 32 +++- ShopTC/Models/Model.Context.cs | 1 + ShopTC/Models/Model.edmx | 53 ++++-- ShopTC/Models/Model.edmx.diagram | 1 + ShopTC/Models/sysdiagrams.cs | 23 +++ ShopTC/ShopTC.csproj | 13 +- ShopTC/Views/DangNhap/DangNhap.cshtml | 2 +- ShopTC/Views/GioHang/Index.cshtml | 85 ++++++++++ ShopTC/Views/GioHang/Pay.cshtml | 15 ++ ShopTC/Views/Home/About.cshtml | 7 - ShopTC/Views/Home/Contact.cshtml | 17 -- ShopTC/Views/Home/Index.cshtml | 31 ---- ShopTC/Views/Shared/_LayoutAdmin.cshtml | 3 +- ShopTC/Views/ThongKe/Index.cshtml | 35 ++++ ShopTC/Views/ThuCungs/Create.cshtml | 150 ++++++++--------- ShopTC/Views/ThuCungs/Delete.cshtml | 155 +++++++---------- ShopTC/Views/ThuCungs/Details.cshtml | 141 +++++++--------- ShopTC/Views/ThuCungs/Edit.cshtml | 93 ++++++---- ShopTC/Views/ThuCungs/Index2.cshtml | 4 +- ShopTC/Web.config | 130 +++++++------- 24 files changed, 876 insertions(+), 512 deletions(-) create mode 100644 ShopTC/Controllers/ThongKeController.cs create mode 100644 ShopTC/Models/sysdiagrams.cs create mode 100644 ShopTC/Views/GioHang/Index.cshtml create mode 100644 ShopTC/Views/GioHang/Pay.cshtml delete mode 100644 ShopTC/Views/Home/About.cshtml delete mode 100644 ShopTC/Views/Home/Contact.cshtml delete mode 100644 ShopTC/Views/Home/Index.cshtml create mode 100644 ShopTC/Views/ThongKe/Index.cshtml diff --git a/ShopTC/Controllers/Cart.cs b/ShopTC/Controllers/Cart.cs index be33800..806a760 100644 --- a/ShopTC/Controllers/Cart.cs +++ b/ShopTC/Controllers/Cart.cs @@ -7,10 +7,12 @@ namespace ShopTC.Controllers { public class Cart { - string name, photo, price, quantity; + public string name, photo, id; + public int price, quantity; - public Cart(string name, string photo, string price, string quantity) + public Cart(string id, string name, string photo, int price, int quantity) { + this.id = id; this.name = name; this.photo = photo; this.price = price; diff --git a/ShopTC/Controllers/DangNhapController.cs b/ShopTC/Controllers/DangNhapController.cs index d437b74..b9eaf7c 100644 --- a/ShopTC/Controllers/DangNhapController.cs +++ b/ShopTC/Controllers/DangNhapController.cs @@ -46,7 +46,7 @@ public ActionResult DangNhap(string Email, string password) if (CheckUser(Email, password)) { FormsAuthentication.SetAuthCookie(Email, true); - return RedirectToAction("Index", "ThuCungs"); + return RedirectToAction("Index2", "ThuCungs"); } else ModelState.AddModelError("", "Tên đăng nhập hoặc tài khoản không đúng."); @@ -59,7 +59,12 @@ public ActionResult DangNhap(string Email, string password) public ActionResult Logout() { - Session.Clear();//remove session + + //Session.Clear();//remove session + + Session.Remove("HoTen"); + Session.Remove("ID"); + Session.Remove("Admin"); FormsAuthentication.SignOut(); return RedirectToAction("DangNhap", "DangNhap"); } @@ -69,76 +74,7 @@ public ActionResult Index() return View(); } - // GET: DangNhap/Details/5 - public ActionResult Details(int id) - { - return View(); - } - - // GET: DangNhap/Create - public ActionResult Create() - { - return View(); - } - - // POST: DangNhap/Create - [HttpPost] - public ActionResult Create(FormCollection collection) - { - try - { - // TODO: Add insert logic here - - return RedirectToAction("Index"); - } - catch - { - return View(); - } - } - - // GET: DangNhap/Edit/5 - public ActionResult Edit(int id) - { - return View(); - } - - // POST: DangNhap/Edit/5 - [HttpPost] - public ActionResult Edit(int id, FormCollection collection) - { - try - { - // TODO: Add update logic here - return RedirectToAction("Index"); - } - catch - { - return View(); - } - } - // GET: DangNhap/Delete/5 - public ActionResult Delete(int id) - { - return View(); - } - - // POST: DangNhap/Delete/5 - [HttpPost] - public ActionResult Delete(int id, FormCollection collection) - { - try - { - // TODO: Add delete logic here - - return RedirectToAction("Index"); - } - catch - { - return View(); - } - } } } diff --git a/ShopTC/Controllers/GioHangController.cs b/ShopTC/Controllers/GioHangController.cs index 1606f4e..b60fa2b 100644 --- a/ShopTC/Controllers/GioHangController.cs +++ b/ShopTC/Controllers/GioHangController.cs @@ -3,32 +3,230 @@ using System.Linq; using System.Web; using System.Web.Mvc; +using ShopTC.Controllers; +using ShopTC.Models; namespace ShopTC.Controllers { public class GioHangController : Controller { + private QLBHTCEntities db = new QLBHTCEntities(); // GET: GioHang private const string CartSession = "CartSesion"; public ActionResult Index() { - return View(); + if (Session["ID"] == null || Session["ID"].ToString() == "") + { + return RedirectToAction("DangNhap", "DangNhap"); + + } + + var cart = Session[CartSession]; + var list = new List(); + if (cart != null) + { + list = (List)cart; + } + + var id = Session["ID"]; + var temp = db.Users.Find(id); + + if (temp != null) + { + ViewBag.name = temp.TenUser; + ViewBag.address = temp.DiaChi; + ViewBag.phone = temp.SDT; + ViewBag.email = temp.Email; + } + + return View(list); } public ActionResult AddToCart(string id) { - Session[CartSession] = "alo"; + if (Session["ID"] == null || Session["ID"].ToString() == "") + { + return RedirectToAction("DangNhap", "DangNhap"); + + } + + + var cart = Session[CartSession]; + + var temp = db.ThuCung.Find(id); - if (Session[CartSession] == null) + if (cart != null) { + // lấy giá trị của sesion + List list = (List)cart; + + // tìm kiếm + if (list.Exists(x => x.id == id)) + { + // tăng lên 1 đơn vị + foreach (var item in list) + { + if (item.id == id) + { + item.quantity++; + } + } + } + else + { + + // nếu tìm k ra thì add mới vào + Cart c = new Cart(temp.MaTC, temp.TenTC, temp.HinhAnhMH, temp.GiaTC, 1); + list.Add(c); + } + Session[CartSession] = list; } else { + // chưa có thì tạo ra giỏ hàng + Cart c = new Cart(temp.MaTC, temp.TenTC, temp.HinhAnhMH, temp.GiaTC, 1); + List list = new List(); + + // thêm hàng zô + list.Add(c); + + // gán lại sesion + Session[CartSession] = list; + + } + + return RedirectToAction("Index2", "ThuCungs", db.ThuCung); + } + + public ActionResult addQuantity(string id, string a) + { + + var cart = Session[CartSession]; + + // lấy giá trị của sesion + List list = (List)cart; + + + // tìm kiếm + if (list.Exists(x => x.id == id)) + { + // tăng lên 1 đơn vị + foreach (var item in list) + { + if (item.id == id) + { + item.quantity = a == "+" ? item.quantity + 1 : item.quantity - 1; + } + if (item.quantity == 0) + { + list.Remove(item); + return RedirectToAction("Index", list); + } + } + } + Session[CartSession] = list; + + + return RedirectToAction("Index", list); + } + + public ActionResult removeEach(string id) + { + var cart = Session[CartSession]; + + // lấy giá trị của sesion + List list = (List)cart; + + + if (list.Exists(x => x.id == id)) + { + // tăng lên 1 đơn vị + foreach (var item in list) + { + if (item.id == id) + { + list.Remove(item); + return RedirectToAction("Index", list); + } + } + } + Session[CartSession] = list; + + + return RedirectToAction("Index", list); + } + + public ActionResult RemoveAll() + { + Session.Remove(CartSession); + var cart = Session[CartSession]; + + List list = (List)cart; + + return RedirectToAction("Index", list); + } + + [HttpGet] + public ActionResult Pay(string name, string address, string phone, string mail, string sale) + { + if (Session["ID"] == null || Session["ID"].ToString() == "") + { + return RedirectToAction("DangNhap", "DangNhap"); + } - return View(); + var cart = Session[CartSession]; + var list = new List(); + if (cart != null) + { + // tổng tiền + int sum = 0; + + // lấy sesion + list = (List)cart; + + + // thêm Hóa Đơn + HoaDon hoaDon = new HoaDon(); + Random rnd = new Random(); + hoaDon.MaHD = DateTime.Now.ToString("ddMM") + rnd.Next(1, 999999); + hoaDon.MaUser = Session["ID"].ToString(); + hoaDon.NgayTao = DateTime.Now; + hoaDon.TenNguoiShip = name; + hoaDon.DiaChiShip = address; + hoaDon.SDTShip = phone; + hoaDon.EmailShip = mail; + foreach (var item in list) + { + sum += item.price * item.quantity; + } + hoaDon.TongTien = sum; + + + db.HoaDon.Add(hoaDon); + db.SaveChanges(); + // thêm chi tiết hóa đơn + foreach (var item in list) + { + var cthd = new CTHoaDon(); + cthd.MaHD = hoaDon.MaHD; + cthd.MaTC = item.id; + cthd.SoLuong = item.quantity; + cthd.DonGia = item.price; + db.CTHoaDon.Add(cthd); + + } + + db.SaveChanges(); + return View(); + + + } + + return View(db.HoaDon.ToList()); } + } } \ No newline at end of file diff --git a/ShopTC/Controllers/ThongKeController.cs b/ShopTC/Controllers/ThongKeController.cs new file mode 100644 index 0000000..f17ef34 --- /dev/null +++ b/ShopTC/Controllers/ThongKeController.cs @@ -0,0 +1,107 @@ +using ShopTC.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; + +namespace ShopTC.Controllers +{ + public class ThongKeController : Controller + { + private QLBHTCEntities db = new QLBHTCEntities(); + // GET: ThongKe + + public ActionResult Index() + { + + return View(db.HoaDon.ToList()); + } + + [HttpPost] + + public ActionResult Index(string nameStart, string nameEnd) + { + + DateTime start = DateTime.Parse(nameStart); + DateTime end = DateTime.Parse(nameEnd); + var hd = db.HoaDon.Where(x => x.NgayTao >= start && x.NgayTao <= end); + + return View(hd.ToList()); + } + + + + // GET: ThongKe/Details/5 + public ActionResult Details(int id) + { + return View(); + } + + // GET: ThongKe/Create + public ActionResult Create() + { + return View(); + } + + // POST: ThongKe/Create + [HttpPost] + public ActionResult Create(FormCollection collection) + { + try + { + // TODO: Add insert logic here + + return RedirectToAction("Index"); + } + catch + { + return View(); + } + } + + // GET: ThongKe/Edit/5 + public ActionResult Edit(int id) + { + return View(); + } + + // POST: ThongKe/Edit/5 + [HttpPost] + public ActionResult Edit(int id, FormCollection collection) + { + try + { + // TODO: Add update logic here + + return RedirectToAction("Index"); + } + catch + { + return View(); + } + } + + // GET: ThongKe/Delete/5 + public ActionResult Delete(int id) + { + return View(); + } + + // POST: ThongKe/Delete/5 + [HttpPost] + public ActionResult Delete(int id, FormCollection collection) + { + try + { + // TODO: Add delete logic here + + return RedirectToAction("Index"); + } + catch + { + return View(); + } + } + } +} diff --git a/ShopTC/Controllers/ThuCungsController.cs b/ShopTC/Controllers/ThuCungsController.cs index a62e128..70db7a2 100644 --- a/ShopTC/Controllers/ThuCungsController.cs +++ b/ShopTC/Controllers/ThuCungsController.cs @@ -13,6 +13,14 @@ namespace ShopTC.Controllers public class ThuCungsController : Controller { private QLBHTCEntities db = new QLBHTCEntities(); + string LayMaTC() + { + var maMax = db.ThuCung.ToList().Select(n => n.MaTC).Max(); + int maTC = int.Parse(maMax.Substring(2)) + 1; + string NV = String.Concat("000", maTC.ToString()); + return "TC" + NV.Substring(maTC.ToString().Length - 1); + } + // GET: ThuCungs public ActionResult Index() @@ -20,7 +28,6 @@ public ActionResult Index() if (Session["ID"] == null || Session["ID"].ToString() == "") { return RedirectToAction("Index2", "ThuCungs"); - } else { @@ -55,6 +62,7 @@ public ActionResult Details(string id) // GET: ThuCungs/Create public ActionResult Create() { + ViewBag.MaTC = LayMaTC(); ViewBag.MaLoai = new SelectList(db.LoaiThuCung, "MaLoai", "TenLoai"); ViewBag.MaCC = new SelectList(db.NHACC, "MaCC", "TenCC"); return View(); @@ -67,8 +75,17 @@ public ActionResult Create() [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "MaTC,TenTC,GiaTC,SoLuong,GT,MoTa,HinhAnhMH,MaLoai,MaCC,NgaySinh")] ThuCung thuCung) { + //System.Web.HttpPostedFileBase Avatar; + var imgTC = Request.Files["Avatar"]; + //Lấy thông tin từ input type=file có tên Avatar + string postedFileName = System.IO.Path.GetFileName(imgTC.FileName); + //Lưu hình đại diện về Server + var path = Server.MapPath("/Images/" + postedFileName); + imgTC.SaveAs(path); if (ModelState.IsValid) { + thuCung.MaTC = LayMaTC(); + thuCung.HinhAnhMH = postedFileName; db.ThuCung.Add(thuCung); db.SaveChanges(); return RedirectToAction("Index"); @@ -103,6 +120,17 @@ public ActionResult Edit(string id) [ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "MaTC,TenTC,GiaTC,SoLuong,GT,MoTa,HinhAnhMH,MaLoai,MaCC,NgaySinh")] ThuCung thuCung) { + var imgTC = Request.Files["Avatar"]; + try + { + //Lấy thông tin từ input type=file có tên Avatar + string postedFileName = System.IO.Path.GetFileName(imgTC.FileName); + //Lưu hình đại diện về Server + var path = Server.MapPath("/Images/" + postedFileName); + imgTC.SaveAs(path); + } + catch + { } if (ModelState.IsValid) { db.Entry(thuCung).State = EntityState.Modified; @@ -137,7 +165,7 @@ public ActionResult DeleteConfirmed(string id) ThuCung thuCung = db.ThuCung.Find(id); db.ThuCung.Remove(thuCung); db.SaveChanges(); - return RedirectToAction("Index"); + return RedirectToAction("Index"); ; } protected override void Dispose(bool disposing) diff --git a/ShopTC/Models/Model.Context.cs b/ShopTC/Models/Model.Context.cs index e66cfd7..eb833be 100644 --- a/ShopTC/Models/Model.Context.cs +++ b/ShopTC/Models/Model.Context.cs @@ -33,5 +33,6 @@ protected override void OnModelCreating(DbModelBuilder modelBuilder) public virtual DbSet ThuCung { get; set; } public virtual DbSet Users { get; set; } public virtual DbSet CTHoaDon { get; set; } + public virtual DbSet sysdiagrams { get; set; } } } diff --git a/ShopTC/Models/Model.edmx b/ShopTC/Models/Model.edmx index 4f380b6..39b31f9 100644 --- a/ShopTC/Models/Model.edmx +++ b/ShopTC/Models/Model.edmx @@ -4,15 +4,11 @@ - - + - - @@ -58,6 +54,16 @@ warning 6002: The table/view 'QLBHTC.dbo.CTHoaDon' does not have a primary key d + + + + + + + + + + @@ -160,21 +166,15 @@ warning 6002: The table/view 'QLBHTC.dbo.CTHoaDon' does not have a primary key d + + - - SELECT - [CTHoaDon].[MaHD] AS [MaHD], - [CTHoaDon].[MaTC] AS [MaTC], - [CTHoaDon].[SoLuong] AS [SoLuong], - [CTHoaDon].[DonGia] AS [DonGia] - FROM [dbo].[CTHoaDon] AS [CTHoaDon] - @@ -196,8 +196,7 @@ warning 6002: The table/view 'QLBHTC.dbo.CTHoaDon' does not have a primary key d - - + @@ -293,8 +292,6 @@ warning 6002: The table/view 'QLBHTC.dbo.CTHoaDon' does not have a primary key d - - @@ -392,7 +389,18 @@ warning 6002: The table/view 'QLBHTC.dbo.CTHoaDon' does not have a primary key d + + + + + + + + + + + @@ -496,6 +504,17 @@ warning 6002: The table/view 'QLBHTC.dbo.CTHoaDon' does not have a primary key d + + + + + + + + + + + diff --git a/ShopTC/Models/Model.edmx.diagram b/ShopTC/Models/Model.edmx.diagram index 2d396a8..be59f8c 100644 --- a/ShopTC/Models/Model.edmx.diagram +++ b/ShopTC/Models/Model.edmx.diagram @@ -18,6 +18,7 @@ + diff --git a/ShopTC/Models/sysdiagrams.cs b/ShopTC/Models/sysdiagrams.cs new file mode 100644 index 0000000..6e94547 --- /dev/null +++ b/ShopTC/Models/sysdiagrams.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ShopTC.Models +{ + using System; + using System.Collections.Generic; + + public partial class sysdiagrams + { + public string name { get; set; } + public int principal_id { get; set; } + public int diagram_id { get; set; } + public Nullable version { get; set; } + public byte[] definition { get; set; } + } +} diff --git a/ShopTC/ShopTC.csproj b/ShopTC/ShopTC.csproj index 2c33b8c..a717802 100644 --- a/ShopTC/ShopTC.csproj +++ b/ShopTC/ShopTC.csproj @@ -132,6 +132,7 @@ + Global.asax @@ -166,6 +167,9 @@ Model.tt + + Model.tt + Model.tt @@ -227,9 +231,6 @@ - - - @@ -238,11 +239,13 @@ + + +
- - + diff --git a/ShopTC/Views/DangNhap/DangNhap.cshtml b/ShopTC/Views/DangNhap/DangNhap.cshtml index 841c930..6b2f4ee 100644 --- a/ShopTC/Views/DangNhap/DangNhap.cshtml +++ b/ShopTC/Views/DangNhap/DangNhap.cshtml @@ -1,6 +1,6 @@ @model ShopTC.Models.Users @{ - ViewBag.Title = "DangNhap"; + ViewBag.Title = "Đăng nhập"; Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; } + +@using (Html.BeginForm("Pay", "GioHang", FormMethod.Get)) +{ + + +
+ + +
+ + +
+ + +
+ + + + + + + +@Html.ActionLink("Xóa Tất cả", "RemoveAll", "GioHang") + + + + + + + + + + @foreach (var item in Model) + { + + + + + + + + + + + } + +
TênGiáHinhSố LượngThanh tien Chức Năng
+ @item.name + + @item.price + + @item.photo + + @Html.ActionLink("-", "addQuantity", new { id = item.id, a = "-" }) + @item.quantity + @Html.ActionLink("+", "addQuantity", new { id = item.id, a = "+" }) + + @{ sum = item.price * item.quantity; tongTien += sum;} + @sum + + @Html.ActionLink("X", "removeEach", new { id = item.id }) + +
+ + +

Tong tien : @tongTien

+ + + +} \ No newline at end of file diff --git a/ShopTC/Views/GioHang/Pay.cshtml b/ShopTC/Views/GioHang/Pay.cshtml new file mode 100644 index 0000000..354f987 --- /dev/null +++ b/ShopTC/Views/GioHang/Pay.cshtml @@ -0,0 +1,15 @@ +@model IEnumerable +@{ + ViewBag.Title = "Pay"; + Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; +} + +

Pay

+ +

Thanh Toan Thanh Cong

+ +@* +@foreach (var item in Model) +{ + @item.MaUser; +}*@ \ No newline at end of file diff --git a/ShopTC/Views/Home/About.cshtml b/ShopTC/Views/Home/About.cshtml deleted file mode 100644 index 4b2d9e8..0000000 --- a/ShopTC/Views/Home/About.cshtml +++ /dev/null @@ -1,7 +0,0 @@ -@{ - ViewBag.Title = "About"; -} -

@ViewBag.Title.

-

@ViewBag.Message

- -

Use this area to provide additional information.

diff --git a/ShopTC/Views/Home/Contact.cshtml b/ShopTC/Views/Home/Contact.cshtml deleted file mode 100644 index 0f4327e..0000000 --- a/ShopTC/Views/Home/Contact.cshtml +++ /dev/null @@ -1,17 +0,0 @@ -@{ - ViewBag.Title = "Contact"; -} -

@ViewBag.Title.

-

@ViewBag.Message

- -
- One Microsoft Way
- Redmond, WA 98052-6399
- P: - 425.555.0100 -
- -
- Support: Support@example.com
- Marketing: Marketing@example.com -
\ No newline at end of file diff --git a/ShopTC/Views/Home/Index.cshtml b/ShopTC/Views/Home/Index.cshtml deleted file mode 100644 index 32e1dd9..0000000 --- a/ShopTC/Views/Home/Index.cshtml +++ /dev/null @@ -1,31 +0,0 @@ -@{ - ViewBag.Title = "Home Page"; -} - -
-

ASP.NET

-

ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.

-

Learn more »

-
- -
-
-

Getting started

-

- 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. -

-

Learn more »

-
-
-

Get more libraries

-

NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

-

Learn more »

-
-
-

Web Hosting

-

You can easily find a web hosting company that offers the right mix of features and price for your applications.

-

Learn more »

-
-
\ No newline at end of file diff --git a/ShopTC/Views/Shared/_LayoutAdmin.cshtml b/ShopTC/Views/Shared/_LayoutAdmin.cshtml index 3acfb74..c4bea87 100644 --- a/ShopTC/Views/Shared/_LayoutAdmin.cshtml +++ b/ShopTC/Views/Shared/_LayoutAdmin.cshtml @@ -44,7 +44,8 @@ }  |  @Html.ActionLink("Thú Cưng", "../ThuCungs/Index2", new { @class = "a" }) |  - @Html.ActionLink("Thống kê", "../ThongKe/Index", new { @class = "a" }) + @Html.ActionLink("Thống kê", "../ThongKe/Index", new { @class = "a" })  |  + @Html.ActionLink("Giỏ Hàng", "../GioHang/Index")

@ViewBag.NguoiDung


diff --git a/ShopTC/Views/ThongKe/Index.cshtml b/ShopTC/Views/ThongKe/Index.cshtml new file mode 100644 index 0000000..f94ff19 --- /dev/null +++ b/ShopTC/Views/ThongKe/Index.cshtml @@ -0,0 +1,35 @@ +@model IEnumerable + +@{ + ViewBag.Title = "Index"; + Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; +} + +@using (Html.BeginForm("Index", "ThongKe", FormMethod.Post)) +{ + + + + + +
+ + + +} + + + + + + + + @foreach (var item in Model) + { + + + + + + } +
ma Hoa donngay taoTong tien
@item.MaHD @item.NgayTao @item.TongTien
\ No newline at end of file diff --git a/ShopTC/Views/ThuCungs/Create.cshtml b/ShopTC/Views/ThuCungs/Create.cshtml index c778b4e..812fe2f 100644 --- a/ShopTC/Views/ThuCungs/Create.cshtml +++ b/ShopTC/Views/ThuCungs/Create.cshtml @@ -2,111 +2,111 @@ @{ ViewBag.Title = "Create"; - Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; }

Create

-@using (Html.BeginForm()) +

THÊM THÚ CƯNG

+@using (Html.BeginForm("Create", "ThuCungs", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.AntiForgeryToken() - -
-

ThuCung

-
- @Html.ValidationSummary(true, "", new { @class = "text-danger" }) -
- @Html.LabelFor(model => model.MaTC, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.MaTC, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.MaTC, "", new { @class = "text-danger" }) -
-
-
- @Html.LabelFor(model => model.TenTC, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.TenTC, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.TenTC, "", new { @class = "text-danger" }) -
+
+
+ @Html.ValidationSummary(true, "", new { @class = "text-danger" }) +
+ @Html.LabelFor(model => model.MaTC, "Mã thú cưng", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ + @*@Html.EditorFor(model => model.MaNV,"@ViewBag.MaNV", new { htmlAttributes = new { @class = "form-control",disabled = "disabled", @readonly = "readonly" } })*@ + @Html.ValidationMessageFor(model => model.MaTC, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.GiaTC, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.GiaTC, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.GiaTC, "", new { @class = "text-danger" }) -
+
+ @Html.LabelFor(model => model.TenTC, "Tên thú cưng", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.TenTC, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.TenTC, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.SoLuong, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.SoLuong, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.SoLuong, "", new { @class = "text-danger" }) -
+
+ @Html.LabelFor(model => model.GiaTC, "Giá thú cưng", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.GiaTC, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.GiaTC, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.GT, htmlAttributes: new { @class = "control-label col-md-2" }) -
-
- @Html.EditorFor(model => model.GT) - @Html.ValidationMessageFor(model => model.GT, "", new { @class = "text-danger" }) -
-
+
+ @Html.LabelFor(model => model.SoLuong, "Số lượng", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.SoLuong, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.SoLuong, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.MoTa, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.MoTa, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.MoTa, "", new { @class = "text-danger" }) +
+ @Html.LabelFor(model => model.GT, "Giới tính", htmlAttributes: new { @class = "control-label col-md-2" }) +
+
+ Đực @Html.RadioButtonFor(model => model.GT, "True", new { @checked = "checked" })   + Cái @Html.RadioButtonFor(model => model.GT, "False") + @Html.ValidationMessageFor(model => model.GT, "", new { @class = "text-danger" })
+
+
-
- @Html.LabelFor(model => model.HinhAnhMH, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.HinhAnhMH, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.HinhAnhMH, "", new { @class = "text-danger" }) -
+
+ @Html.LabelFor(model => model.MoTa, "Mô tả", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.MoTa, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.MoTa, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.MaLoai, "MaLoai", htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.DropDownList("MaLoai", null, htmlAttributes: new { @class = "form-control" }) - @Html.ValidationMessageFor(model => model.MaLoai, "", new { @class = "text-danger" }) -
+
+ @Html.LabelFor(model => model.HinhAnhMH, "Ảnh minh họa", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ + @Html.ValidationMessageFor(model => model.HinhAnhMH, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.MaCC, "MaCC", htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.DropDownList("MaCC", null, htmlAttributes: new { @class = "form-control" }) - @Html.ValidationMessageFor(model => model.MaCC, "", new { @class = "text-danger" }) -
+
+ @Html.LabelFor(model => model.NgaySinh, "Ngày sinh", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.NgaySinh, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.NgaySinh, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.NgaySinh, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.NgaySinh, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.NgaySinh, "", new { @class = "text-danger" }) -
+
+ @Html.LabelFor(model => model.MaLoai, "Loại TC", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.DropDownList("MaLoai", null, htmlAttributes: new { @class = "form-control" }) + @Html.ValidationMessageFor(model => model.MaLoai, "", new { @class = "text-danger" })
+
+
+ @Html.LabelFor(model => model.MaCC, "Nhà cung cấp TC", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.DropDownList("MaCC", null, htmlAttributes: new { @class = "form-control" }) + @Html.ValidationMessageFor(model => model.MaCC, "", new { @class = "text-danger" }) +
+
+
+
+ -
-
- -
+
}
- @Html.ActionLink("Back to List", "Index") + @Html.ActionLink("Quay lại", "Index")
- diff --git a/ShopTC/Views/ThuCungs/Delete.cshtml b/ShopTC/Views/ThuCungs/Delete.cshtml index 693641e..5b3fba4 100644 --- a/ShopTC/Views/ThuCungs/Delete.cshtml +++ b/ShopTC/Views/ThuCungs/Delete.cshtml @@ -2,96 +2,69 @@ @{ ViewBag.Title = "Delete"; - Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; + string gtinh = ""; } -

Delete

- -

Are you sure you want to delete this?

-
-

ThuCung

-
-
-
- @Html.DisplayNameFor(model => model.TenTC) -
- -
- @Html.DisplayFor(model => model.TenTC) -
- -
- @Html.DisplayNameFor(model => model.GiaTC) -
- -
- @Html.DisplayFor(model => model.GiaTC) -
- -
- @Html.DisplayNameFor(model => model.SoLuong) -
- -
- @Html.DisplayFor(model => model.SoLuong) -
- -
- @Html.DisplayNameFor(model => model.GT) -
- -
- @Html.DisplayFor(model => model.GT) -
- -
- @Html.DisplayNameFor(model => model.MoTa) -
- -
- @Html.DisplayFor(model => model.MoTa) -
- -
- @Html.DisplayNameFor(model => model.HinhAnhMH) -
- -
- @Html.DisplayFor(model => model.HinhAnhMH) -
- -
- @Html.DisplayNameFor(model => model.NgaySinh) -
- -
- @Html.DisplayFor(model => model.NgaySinh) -
- -
- @Html.DisplayNameFor(model => model.LoaiThuCung.TenLoai) -
- -
- @Html.DisplayFor(model => model.LoaiThuCung.TenLoai) -
- -
- @Html.DisplayNameFor(model => model.NHACC.TenCC) -
- -
- @Html.DisplayFor(model => model.NHACC.TenCC) -
- -
- - @using (Html.BeginForm()) { - @Html.AntiForgeryToken() - -
- | - @Html.ActionLink("Back to List", "Index") -
- } -
+

Bạn có chắc chắn xóa thông tin này?

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
THÔNG TIN CHI TIẾT
Mã thú cưng:@Html.DisplayFor(model => model.MaTC)
Tên thú cưng:@Html.DisplayFor(model => model.TenTC)
Giá:@Html.DisplayFor(model => model.GiaTC)
Số lượng:@Html.DisplayFor(model => model.GiaTC)
Giới tính: + @{if (Model.GT == true) + { gtinh = "Đực"; } + else + { gtinh = "Cái"; } + } + @gtinh +
Mô tả:@Html.DisplayFor(model => model.MoTa)
Ngày sinh:@Html.DisplayFor(model => model.NgaySinh)
Loại:@Html.DisplayFor(model => model.LoaiThuCung.TenLoai)
Nhà cung cấp:@Html.DisplayFor(model => model.NHACC.TenCC)
+
+@using (Html.BeginForm()) +{ + @Html.AntiForgeryToken() + +
+ | + @Html.ActionLink("Quay lại", "Index") +
+} diff --git a/ShopTC/Views/ThuCungs/Details.cshtml b/ShopTC/Views/ThuCungs/Details.cshtml index 10c2336..82eb13b 100644 --- a/ShopTC/Views/ThuCungs/Details.cshtml +++ b/ShopTC/Views/ThuCungs/Details.cshtml @@ -2,90 +2,63 @@ @{ ViewBag.Title = "Details"; - Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; + string gtinh = ""; } -

Details

- -
-

ThuCung

-
-
-
- @Html.DisplayNameFor(model => model.TenTC) -
- -
- @Html.DisplayFor(model => model.TenTC) -
- -
- @Html.DisplayNameFor(model => model.GiaTC) -
- -
- @Html.DisplayFor(model => model.GiaTC) -
- -
- @Html.DisplayNameFor(model => model.SoLuong) -
- -
- @Html.DisplayFor(model => model.SoLuong) -
- -
- @Html.DisplayNameFor(model => model.GT) -
- -
- @Html.DisplayFor(model => model.GT) -
- -
- @Html.DisplayNameFor(model => model.MoTa) -
- -
- @Html.DisplayFor(model => model.MoTa) -
- -
- @Html.DisplayNameFor(model => model.HinhAnhMH) -
- -
- @Html.DisplayFor(model => model.HinhAnhMH) -
- -
- @Html.DisplayNameFor(model => model.NgaySinh) -
- -
- @Html.DisplayFor(model => model.NgaySinh) -
- -
- @Html.DisplayNameFor(model => model.LoaiThuCung.TenLoai) -
- -
- @Html.DisplayFor(model => model.LoaiThuCung.TenLoai) -
- -
- @Html.DisplayNameFor(model => model.NHACC.TenCC) -
- -
- @Html.DisplayFor(model => model.NHACC.TenCC) -
- -
-
-

- @Html.ActionLink("Edit", "Edit", new { id = Model.MaTC }) | - @Html.ActionLink("Back to List", "Index") + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
THÔNG TIN CHI TIẾT
Mã thú cưng:@Html.DisplayFor(model => model.MaTC)
Tên thú cưng:@Html.DisplayFor(model => model.TenTC)
Giá:@Html.DisplayFor(model => model.GiaTC)
Số lượng:@Html.DisplayFor(model => model.GiaTC)
Giới tính: + @{if (Model.GT == true) + { gtinh = "Đực"; } + else + { gtinh = "Cái"; } + } + @gtinh +
Mô tả:@Html.DisplayFor(model => model.MoTa)
Ngày sinh:@Html.DisplayFor(model => model.NgaySinh)
Loại:@Html.DisplayFor(model => model.LoaiThuCung.TenLoai)
Nhà cung cấp:@Html.DisplayFor(model => model.NHACC.TenCC)
+
+

+ @Html.ActionLink("Cập nhật", "Edit", new { id = Model.MaTC }) | + @Html.ActionLink("Quay lại", "Index")

diff --git a/ShopTC/Views/ThuCungs/Edit.cshtml b/ShopTC/Views/ThuCungs/Edit.cshtml index 6331b37..0652392 100644 --- a/ShopTC/Views/ThuCungs/Edit.cshtml +++ b/ShopTC/Views/ThuCungs/Edit.cshtml @@ -2,105 +2,124 @@ @{ ViewBag.Title = "Edit"; - Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; + + } -

Edit

+

CẬP NHẬT THÔNG TIN THÚ CƯNG

- -@using (Html.BeginForm()) +@using (Html.BeginForm("Edit", "ThuCungs", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.AntiForgeryToken() - +
-

ThuCung

+
@Html.ValidationSummary(true, "", new { @class = "text-danger" }) @Html.HiddenFor(model => model.MaTC) +
+ @Html.LabelFor(model => model.MaTC, "Mã thú cưng", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.EditorFor(model => model.MaTC, new { htmlAttributes = new { @class = "form-control", disabled = "disabled", @readonly = "readonly" } }) + @Html.ValidationMessageFor(model => model.MaTC, "", new { @class = "text-danger" }) +
+
-
- @Html.LabelFor(model => model.TenTC, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.TenTC, "Tên thú cưng", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.TenTC, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.TenTC, "", new { @class = "text-danger" })
-
- @Html.LabelFor(model => model.GiaTC, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.GiaTC, "Giá thú cưng", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.GiaTC, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.GiaTC, "", new { @class = "text-danger" })
-
- @Html.LabelFor(model => model.SoLuong, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.SoLuong, "Số lượng", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.SoLuong, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.SoLuong, "", new { @class = "text-danger" })
-
- @Html.LabelFor(model => model.GT, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.GT, "Giới tính", htmlAttributes: new { @class = "control-label col-md-2" })
- @Html.EditorFor(model => model.GT) + Đực @Html.RadioButtonFor(model => model.GT, "True", new { @checked = "checked" })   + Cái @Html.RadioButtonFor(model => model.GT, "False") @Html.ValidationMessageFor(model => model.GT, "", new { @class = "text-danger" })
+
-
- @Html.LabelFor(model => model.MoTa, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.MoTa, "Mô tả", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.MoTa, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.MoTa, "", new { @class = "text-danger" })
-
- @Html.LabelFor(model => model.HinhAnhMH, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.HinhAnhMH, "Ảnh minh họa", htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.HinhAnhMH, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.HinhAnhMH, "", new { @class = "text-danger" }) +
-
- @Html.LabelFor(model => model.MaLoai, "MaLoai", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.NgaySinh, "Ngày sinh", htmlAttributes: new { @class = "control-label col-md-2" })
- @Html.DropDownList("MaLoai", null, htmlAttributes: new { @class = "form-control" }) - @Html.ValidationMessageFor(model => model.MaLoai, "", new { @class = "text-danger" }) + @Html.EditorFor(model => model.NgaySinh, new { htmlAttributes = new { @class = "form-control" } }) + @Html.ValidationMessageFor(model => model.NgaySinh, "", new { @class = "text-danger" })
-
- @Html.LabelFor(model => model.MaCC, "MaCC", htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.MaLoai, "Loại TC", htmlAttributes: new { @class = "control-label col-md-2" })
- @Html.DropDownList("MaCC", null, htmlAttributes: new { @class = "form-control" }) - @Html.ValidationMessageFor(model => model.MaCC, "", new { @class = "text-danger" }) + @Html.DropDownList("MaLoai", null, htmlAttributes: new { @class = "form-control" }) + @Html.ValidationMessageFor(model => model.MaLoai, "", new { @class = "text-danger" })
- -
- @Html.LabelFor(model => model.NgaySinh, htmlAttributes: new { @class = "control-label col-md-2" }) +
+ @Html.LabelFor(model => model.MaCC, "Nhà cung cấp TC", htmlAttributes: new { @class = "control-label col-md-2" })
- @Html.EditorFor(model => model.NgaySinh, new { htmlAttributes = new { @class = "form-control" } }) - @Html.ValidationMessageFor(model => model.NgaySinh, "", new { @class = "text-danger" }) + @Html.DropDownList("MaCC", null, htmlAttributes: new { @class = "form-control" }) + @Html.ValidationMessageFor(model => model.MaCC, "", new { @class = "text-danger" })
- -
+
- +
}
- @Html.ActionLink("Back to List", "Index") + @Html.ActionLink("Quay lại", "Index")
- diff --git a/ShopTC/Views/ThuCungs/Index2.cshtml b/ShopTC/Views/ThuCungs/Index2.cshtml index 0a350f2..147a8b4 100644 --- a/ShopTC/Views/ThuCungs/Index2.cshtml +++ b/ShopTC/Views/ThuCungs/Index2.cshtml @@ -4,15 +4,15 @@ Layout = "~/Views/Shared/_LayoutAdmin.cshtml"; } +
@foreach (var item in Model) { -
Alternate Text

@item.TenTC

@item.GiaTC

- @Html.ActionLink("Thêm Giỏ Hàng", "AddToCart", "GioHang", new { id = item.MaTC }) + @Html.ActionLink("Thêm Giỏ Hàng", "AddToCart", "GioHang", new { id = item.MaTC }, null)
}
diff --git a/ShopTC/Web.config b/ShopTC/Web.config index fe526c1..1e45fec 100644 --- a/ShopTC/Web.config +++ b/ShopTC/Web.config @@ -4,69 +4,69 @@ https://go.microsoft.com/fwlink/?LinkId=301880 --> - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file