public ActionResult Create([Bind(Include = "idevento,nombre,fecha_inicio,fecha_final,organizador,idcategoria")] Evento evento)
        {
            if (ModelState.IsValid)
            {
                EventoBLL.Create(evento);
                return(RedirectToAction("Index"));
            }

            ViewBag.categoria = new SelectList(CategoriaBLL.List(), "idcategoria", "nombre", evento.idcategoria);
            return(View(evento));
        }
 public IHttpActionResult Post(Evento Evento)
 {
     try
     {
         EventoBLL.Create(Evento);
         return(Content(HttpStatusCode.Created, "Evento creado correctamente"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Пример #3
0
        public ActionResult Create(tblEvento evento)
        {
            var          eveBLL = new EventoBLL();
            ActionResult Result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    eveBLL.Create(evento);
                    Result = RedirectToAction("Index");
                }
                else
                {
                    Result = RedirectToAction("Index");
                }
            }
            catch
            {
                Result = RedirectToAction("Index");
            }
            return(Result);
        }