public JsonResult Delete(int id) { ImagePhong obj = db.ImagePhongs.Find(id); db.ImagePhongs.Remove(obj); return(Json(db.SaveChanges())); }
public ActionResult Edit(int?id, int?IDPhong) { ImagePhong obj = id > 0 ? db.ImagePhongs.Find(id) : new ImagePhong() { IDPhong = IDPhong }; if (obj == null) { return(HttpNotFound()); } return(View(obj)); }
public ActionResult Edit(ImagePhong obj) { obj.SaveFor(q => q.Link); if (obj.IDImageHome > 0) { db.Entry(obj).State = EntityState.Modified; } else { db.ImagePhongs.Add(obj); } db.SaveChanges(); return(RedirectToAction("Index", "Phong")); }