public ActionResult DeleteConfirmed(int id) { ChiTietPhieuXuatKho chiTietPhieuXuatKho = db.ChiTietPhieuXuatKhoes.Find(id); db.ChiTietPhieuXuatKhoes.Remove(chiTietPhieuXuatKho); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "SoPhieuXuatKho,MaHangHoa,SoLuong,Gia,ThanhTien")] ChiTietPhieuXuatKho chiTietPhieuXuatKho) { if (ModelState.IsValid) { db.Entry(chiTietPhieuXuatKho).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaHangHoa = new SelectList(db.HangHoas, "MaHangHoa", "TenHangHoa", chiTietPhieuXuatKho.MaHangHoa); ViewBag.SoPhieuXuatKho = new SelectList(db.PhieuXuatKhoes, "SoPhieuXuatKho", "LyDoXuat", chiTietPhieuXuatKho.SoPhieuXuatKho); return(View(chiTietPhieuXuatKho)); }
// GET: ChiTietPhieuXuatKho/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChiTietPhieuXuatKho chiTietPhieuXuatKho = db.ChiTietPhieuXuatKhoes.Find(id); if (chiTietPhieuXuatKho == null) { return(HttpNotFound()); } return(View(chiTietPhieuXuatKho)); }
// GET: ChiTietPhieuXuatKho/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChiTietPhieuXuatKho chiTietPhieuXuatKho = db.ChiTietPhieuXuatKhoes.Find(id); if (chiTietPhieuXuatKho == null) { return(HttpNotFound()); } ViewBag.MaHangHoa = new SelectList(db.HangHoas, "MaHangHoa", "TenHangHoa", chiTietPhieuXuatKho.MaHangHoa); ViewBag.SoPhieuXuatKho = new SelectList(db.PhieuXuatKhoes, "SoPhieuXuatKho", "LyDoXuat", chiTietPhieuXuatKho.SoPhieuXuatKho); return(View(chiTietPhieuXuatKho)); }
public async Task <IActionResult> PutChiTietPhieuXuatKho(int id, ChiTietPhieuXuatKho chiTietPhieuXuatKho) { var a = await _context.ChiTietPhieuXuatKhos.FindAsync(id); if (a == null) { return(NotFound()); } a.soluong = chiTietPhieuXuatKho.soluong; //a.gia = chiTietPhieuXuatKho.gia; a.donvi = chiTietPhieuXuatKho.donvi; a.NguyenLieu_ID = chiTietPhieuXuatKho.NguyenLieu_ID; a.PhieuXuatKho_ID = chiTietPhieuXuatKho.PhieuXuatKho_ID; _context.ChiTietPhieuXuatKhos.Update(a); await _context.SaveChangesAsync(); return(Ok(a)); }
public async Task <ActionResult <ChiTietPhieuXuatKho> > PostChiTietPhieuXuatKho(ChiTietPhieuXuatKho chiTietPhieuXuatKho) { NguyenLieu nl = await _context.NguyenLieus.SingleAsync(x => x.Id == chiTietPhieuXuatKho.NguyenLieu_ID); nl.soluong -= chiTietPhieuXuatKho.soluong; _context.ChiTietPhieuXuatKhos.Add(chiTietPhieuXuatKho); await _context.SaveChangesAsync(); return(CreatedAtAction("GetChiTietPhieuXuatKho", new { id = chiTietPhieuXuatKho.Id }, chiTietPhieuXuatKho)); }