public bool Update(KhachHangGiaoDich entity) { try { var model = db.KhachHangGiaoDiches.Find(entity.ID); if (model != null) { model.DonHangID = entity.DonHangID; model.KhachHangID = entity.KhachHangID; model.NgayGiaoDich = entity.NgayGiaoDich; model.TongTien = entity.TongTien; model.SoLuong = entity.SoLuong; model.TrangThai = entity.TrangThai; db.SaveChanges(); return(true); } else { return(false); } } catch (Exception) { return(false); } }
public ActionResult DeleteConfirmed(long id) { KhachHangGiaoDich khachHangGiaoDich = db.KhachHangGiaoDiches.Find(id); db.KhachHangGiaoDiches.Remove(khachHangGiaoDich); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,DonHangID,KhachHangID,NgayGiaoDich,TongTien,SoLuong,TrangThai")] KhachHangGiaoDich khachHangGiaoDich) { if (ModelState.IsValid) { db.Entry(khachHangGiaoDich).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khachHangGiaoDich)); }
public ActionResult Create([Bind(Include = "ID,DonHangID,KhachHangID,NgayGiaoDich,TongTien,SoLuong,TrangThai")] KhachHangGiaoDich khachHangGiaoDich) { if (ModelState.IsValid) { db.KhachHangGiaoDiches.Add(khachHangGiaoDich); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khachHangGiaoDich)); }
public bool Insert(KhachHangGiaoDich entity) { try { db.KhachHangGiaoDiches.Add(entity); db.SaveChanges(); return(true); } catch (Exception) { return(false); } }
// GET: Admin/KhachHangGiaoDichDaoTM/Delete/5 public ActionResult Delete(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } KhachHangGiaoDich khachHangGiaoDich = db.KhachHangGiaoDiches.Find(id); if (khachHangGiaoDich == null) { return(HttpNotFound()); } return(View(khachHangGiaoDich)); }
public bool Delete(KhachHangGiaoDich entity) { try { var model = db.KhachHangGiaoDiches.Find(entity.ID); if (model != null) { db.KhachHangGiaoDiches.Remove(entity); db.SaveChanges(); return(true); } else { return(false); } } catch (Exception) { return(false); } }