Ejemplo n.º 1
0
        public ActionResult Create(TypesOfEquipment typesofequipment)
        {
            if (ModelState.IsValid)
            {
                if (db.TypesOfEquipments.Any(e=>e.Type==typesofequipment.Type))
                {
                    return View(typesofequipment);
                }
                db.TypesOfEquipments.Add(typesofequipment);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(typesofequipment);
        }
Ejemplo n.º 2
0
 public ActionResult Edit(TypesOfEquipment typesofequipment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(typesofequipment).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(typesofequipment);
 }