예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Hom hom = db.HomItems.Find(id);

            db.HomItems.Remove(hom);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        //
        // GET: /Home/Delete/5

        public ActionResult Delete(int id = 0)
        {
            Hom hom = db.HomItems.Find(id);

            if (hom == null)
            {
                return(HttpNotFound());
            }
            return(View(hom));
        }
예제 #3
0
 public ActionResult Edit(Hom hom)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hom).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hom));
 }
예제 #4
0
        public ActionResult Create(Hom hom)
        {
            if (ModelState.IsValid)
            {
                db.HomItems.Add(hom);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hom));
        }