コード例 #1
0
 public ActionResult Create(alquileres alquileres)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.alquileres.Add(alquileres);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(alquileres));
     }
     catch
     {
         return(View(alquileres));
     }
 }
コード例 #2
0
 public ActionResult Edit(alquileres alquileres)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(alquileres).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(alquileres));
     }
     catch
     {
         return(View(alquileres));
     }
 }
コード例 #3
0
        public ActionResult Delete(int?id, alquileres alquileres)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    alquileres = db.alquileres.Find(id);
                    if (alquileres == null)
                    {
                        return(HttpNotFound());
                    }

                    db.alquileres.Remove(alquileres);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                return(View(alquileres));
            }
            catch
            {
                return(View(alquileres));
            }
        }