public IActionResult DeleteCT(int? Id) { if (Id == null) { return NotFound(); } else { var hd = ictnhaphangs.GetCTNhapHang(Id); XeViewModel xe = ixes.GetXe(hd.Idxe); xe.Soluong -= hd.Soluong; ixes.Create(xe); NhapHangViewModel nhaphang = nhaphangs.GetNhapHang(hd.IdnhapHang); nhaphang.Gia -= xe.Gia * hd.Soluong; nhaphangs.Create(nhaphang); return View(hd); } }
public IActionResult DeleteCT(int?Id) { if (Id == null) { return(NotFound()); } else { ViewBag.Name = HttpContext.Session.GetString("Ten"); var hd = ictnhaphangs.GetCTNhapHang(Id); XeViewModel xe = ixes.GetXe(hd.Idxe); xe.Soluong -= hd.Soluong; ixes.Create(xe); NhapHangViewModel nhaphang = nhaphangs.GetNhapHang(hd.IdnhapHang); nhaphang.Gia -= xe.Gia * hd.Soluong; nhaphangs.Create(nhaphang); return(View(hd)); } }