Exemplo n.º 1
0
        public ActionResult Create(Blog blog)
        {
            try
            {
              db.Blogs.Add(blog);
              db.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id, Blog blog)
        {
            try
            {
                // TODO: Add delete logic here
              db.Entry(blog).State = EntityState.Deleted;
              db.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id, Blog blog)
        {
            try
            {
              db.Entry(blog).State = EntityState.Modified;
              db.SaveChanges();

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