public ActionResult Prd_detail(string tendh) { dongho product = DAO_product.getByName(tendh).First(); product.dongia *= 1000; return(View(product)); }
public ActionResult Delete_Product(string tendh, string url) { dongho check_dh = DAO_product.getByName(tendh).First(); if (check_dh != null) { DAO_product.delete(check_dh); } return(Redirect(url)); }
public ActionResult Edit(int id, dongho dongho) { if (ModelState.IsValid) { var dao = new DongHoDao(); var result = dao.Update(dongho, id); if (result) { return(RedirectToAction("Index", "DongHo")); } else { ModelState.AddModelError("", "Cập nhật user không thành công"); } } return(View("Index")); }
public ActionResult Create(dongho entity) { if (ModelState.IsValid) { var dao = new DongHoDao(); long id = dao.Insert(entity); if (id > 0) { return(RedirectToAction("Index", "DongHo")); } else { ModelState.AddModelError("", "Thêm không thành công"); } } return(View("Index")); }
public bool Update(dongho entity, int id) { try { var dongho = db.donghoes.Find(id); dongho.kh_id = entity.kh_id; dongho.dh_thuonghieu = entity.dh_thuonghieu; dongho.dh_maso = entity.dh_maso; dongho.dh_ngaykiemdinh = entity.dh_ngaykiemdinh; dongho.dh_ngaylap = entity.dh_ngaylap; db.SaveChanges(); return(true); } catch (Exception ex) { //logging return(false); } }
public long Insert(dongho entity) { db.donghoes.Add(entity); db.SaveChanges(); return(entity.dh_id); }
public ActionResult Edit_Prd(dongho dh, string url) { DAO_product.update(dh); return(Redirect(url)); }