Beispiel #1
0
 public ActionResult DeleteConfirmed(int id)
 {
     WebApplication.Models.Type type = db.Types.Find(id);
     db.Types.Remove(type);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "Id,Name")] WebApplication.Models.Type type)
 {
     if (ModelState.IsValid)
     {
         db.Entry(type).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(type));
 }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "Id,Name")] WebApplication.Models.Type type)
        {
            if (ModelState.IsValid)
            {
                db.Types.Add(type);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(type));
        }
Beispiel #4
0
 // GET: Types/Delete/5
 public ActionResult Delete(int?id)
 {
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     WebApplication.Models.Type type = db.Types.Find(id);
     if (type == null)
     {
         return(HttpNotFound());
     }
     return(View(type));
 }
Beispiel #5
0
 public ActionResult Types(Type cat)
 {
     if (ModelState.IsValid)
     {
         _db.Types.Add(cat);
         _db.SaveChanges();
     }
     ViewBag.Types = _db.Types;
     return View(cat);
 }