예제 #1
0
 public ActionResult Delete(int id, writer writer4)
 {
     writer movie = db.writers.Find(id);
     if (movie == null)
     {
         return HttpNotFound();
     }
     db.writers.Remove(movie);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
예제 #2
0
        public ActionResult Create(writer writer2)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.writers.Add(writer2);
                    db.SaveChanges();

                    return RedirectToAction("Index");
                }
                else
                {
                    return View();
                }

            }
            catch
            {
                return View();
            }
        }
예제 #3
0
        public ActionResult Edit(int id, writer writer3)
        {
            try
            {

                if (ModelState.IsValid)
                {
                    db.Entry(writer3).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }
                else
                {
                    return View();
                }
            }
            catch
            {
                return View();
            }
        }