Beispiel #1
0
        //[ValidateAntiForgeryToken]
        public ActionResult Create(Servicio serv)
        {
            //try
            //{
            if (ModelState.IsValid)
            {
                db.Servicios.Add(serv);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            //}
            //catch
            //{
            return(View());
            //}
        }
Beispiel #2
0
        public ActionResult Create(TipoAlojamiento tal)
        {
            //try
            //{
            if (ModelState.IsValid)
            {
                db.TipoAlojamientos.Add(tal);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }


            //}
            //catch
            //{
            return(View());
            //}
        }
Beispiel #3
0
        public ActionResult Create(Temporada temp)
        {
            //try
            //{
            if (ModelState.IsValid)
            {
                db.Temporadas.Add(temp);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }


            //}
            //    catch
            //    {
            return(View());
            //}
        }
Beispiel #4
0
        public ActionResult Edit(Ob_P3_02.ViewModels.AlojamientosViewModel alojamimientoVM)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Entry(alojamimientoVM.UnAlojamiento).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                return(View());
            }
            catch (Exception ex)
            {
                return(View(alojamimientoVM));
            }
        }
Beispiel #5
0
 //[ValidateAntiForgeryToken]
 public ActionResult Create(Ob_P3_02.ViewModels.AlojamientosViewModel alojamimientoVM)
 {
     try
     {
         //
         if (alojamimientoVM.Mapear())
         {
             Alojamiento a = alojamimientoVM.UnAlojamiento;
             if (a != null)
             {
                 BienvenidosUyContext db = new BienvenidosUyContext();
                 db.Entry(a.TipoAlojamiento).State = EntityState.Unchanged;
                 db.Alojamientos.Add(a);
                 db.SaveChanges();
                 return(RedirectToAction("Index"));
             }
         }
         return(View());
     }
     catch (Exception ex)
     {
         return(View(alojamimientoVM));
     }
 }