Beispiel #1
0
        public ActionResult DeleteConfirmed(int id = 0)
        {
            myContact _mycontact = _db.myContacts.Find(id);

            _db.myContacts.Remove(_mycontact);
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit(myContact _mycontact)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(_mycontact).State = System.Data.Entity.EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(_mycontact));
 }
Beispiel #3
0
 public ActionResult Create(myContact _mycontact)
 {
     if (ModelState.IsValid)
     {
         _db.myContacts.Add(_mycontact);
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(_mycontact));
 }
Beispiel #4
0
        public ActionResult Delete(int id = 0)
        {
            myContact _mycontact = _db.myContacts.Find(id);

            if (_mycontact == null)
            {
                return(HttpNotFound());
            }

            return(View(_mycontact));
        }