Example #1
0
        public ActionResult Agregar(fechamodels model)
        {
            var ltorneos = new torneomodels().listatorneos();
            ViewData["listatorneos"] = ltorneos;

            if (ModelState.IsValid)
            {

                MvcApplication6.Models.fecha F = new MvcApplication6.Models.fecha
                {
                    idtorneo = model.idtorneo,
                    nombre = model.nombre,
                    fecha1 = model.fecha1,
                };

                db.fechas.InsertOnSubmit(F);
                try
                {
                    db.SubmitChanges();
                }
                catch
                {
                    TempData["ERROR"] = "No se pudo agregar la fecha, por favor intente nuevamente.";
                    return View();

                }
                TempData["MENSAJE"] = "Se agrego correctamente la fecha.";
                return RedirectToAction("Index");
            }
            TempData["ERROR"] = "Error en el alta de la fecha. Modelo Invalido";
            return View();
        }
Example #2
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Editar(int id)
 {
     MvcApplication6.Models.fecha T = new MvcApplication6.Models.fecha();
     try
     {
         T = db.fechas.Single(q => q.id == id);
         MvcApplication6.Models.fechamodels fmodel = new MvcApplication6.Models.fechamodels();
         fmodel.id       = T.id;
         fmodel.idtorneo = T.idtorneo;
         fmodel.nombre   = T.nombre;
         fmodel.fecha1 = T.fecha1;
         return View(fmodel);
     }
     catch
     {
         TempData["ERROR"] = "No se pudo editar la fecha, por favor intente nuevamente.";
         return RedirectToAction("Index");
     }
 }
Example #3
0
 partial void Deletefecha(fecha instance);
Example #4
0
 partial void Updatefecha(fecha instance);
Example #5
0
 partial void Insertfecha(fecha instance);
Example #6
0
		private void detach_fechas(fecha entity)
		{
			this.SendPropertyChanging();
			entity.torneo = null;
		}
Example #7
0
		private void attach_fechas(fecha entity)
		{
			this.SendPropertyChanging();
			entity.torneo = this;
		}
Example #8
0
 /* --------------------------------------------------------------------------------------  */
 public bool SaveFecha(fechamodels model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             fecha T = new fecha();
             T = db.fechas.Single(q => q.id == model.id);
             T.nombre    = model.nombre;
             T.idtorneo  = model.idtorneo;
             T.nombre    = model.nombre;
             T.fecha1    = model.fecha1;
             db.SubmitChanges();
             return true;
         }
         catch
         {
             return false;
         }
     }
     return false;
 }
Example #9
0
 /* --------------------------------------------------------------------------------------  */
 public ActionResult Eliminar(int id)
 {
     var aux = new fechamodels().verfecha(id).First();
     MvcApplication6.Models.fecha F = new fecha
     {
         id      = aux.id,
         idtorneo=aux.idtorneo,
         nombre  =aux.nombre,
         fecha1  =aux.fecha1,
     };
     try
     {
         db.fechas.Attach(F);
         db.fechas.DeleteOnSubmit(F);
         db.SubmitChanges();
         TempData["MENSAJE"] = "Se elimino correctamente la fecha.";
     }
     catch
     {
         TempData["ERROR"] = "No se pudo eliminar la fecha, por favor intente nuevamente.";
     }
     return RedirectToAction("Index");
 }