public ActionResult Edit(aspnet_Departamentos modified)
 {
     try
     {
         // TODO: Add update logic here
         db.aspnet_Departamentos.Attach(modified);
         db.ObjectStateManager.ChangeObjectState(modified, System.Data.EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         aspnet_Departamentos deleted = db.aspnet_Departamentos.SingleOrDefault(d => d.DepartamentoID == id);
         db.aspnet_Departamentos.DeleteObject(deleted);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(aspnet_Departamentos newDpto)
 {
     try
     {
         // TODO: Add insert logic here
         if (ModelState.IsValid)
         {
             db.AddToaspnet_Departamentos(newDpto);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         else
         {
             return(View(newDpto));
         }
     }
     catch
     {
         return(View());
     }
 }
        //
        // GET: /Departamentos/Delete/5

        public ActionResult Delete(int id)
        {
            aspnet_Departamentos deleted = db.aspnet_Departamentos.FirstOrDefault(d => d.DepartamentoID == id);

            return(View(deleted));
        }
        //
        // GET: /Departamentos/Edit/5

        public ActionResult Edit(int id)
        {
            aspnet_Departamentos departamento = db.aspnet_Departamentos.FirstOrDefault(d => d.DepartamentoID == id);

            return(View(departamento));
        }