public async Task <IActionResult> Create([Bind("IdKhachHang,NameKh,Email,Password,Address,SoDiethoai")] Khachhang khachhang) { if (ModelState.IsValid) { _context.Add(khachhang); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(khachhang)); }
public async Task <IActionResult> Create([Bind("IddanhMuc,TenDm")] Danhmuc danhmuc) { if (ModelState.IsValid) { _context.Add(danhmuc); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(danhmuc)); }
public async Task <IActionResult> Create([Bind("IdsanPham,TenSp,GiaSp,MoTa,DanhMuc")] Sanpham sanpham) { if (ModelState.IsValid) { _context.Add(sanpham); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DanhMuc"] = new SelectList(_context.Danhmuc, "IddanhMuc", "IddanhMuc", sanpham.DanhMuc); return(View(sanpham)); }
public async Task <IActionResult> Create([Bind("Idhoadon,IdNguoimua,IdchiTiet,TongTien,SoLuong,NgayTao,TinhTrang")] Hoadon hoadon) { if (ModelState.IsValid) { _context.Add(hoadon); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdNguoimua"] = new SelectList(_context.Khachhang, "IdKhachHang", "Email", hoadon.IdNguoimua); return(View(hoadon)); }
public async Task <IActionResult> Create([Bind("IdHd,IdSp,Soluong,GiaSp")] Chitiethd chitiethd) { if (ModelState.IsValid) { _context.Add(chitiethd); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdHd"] = new SelectList(_context.Hoadon, "Idhoadon", "Idhoadon", chitiethd.IdHd); ViewData["IdSp"] = new SelectList(_context.Sanpham, "IdsanPham", "IdsanPham", chitiethd.IdSp); return(View(chitiethd)); }