Beispiel #1
0
        public ActionResult GrabarEvento()
        {
            List <string> Retorno  = new List <string>();
            int           IdEvento = 0;

            try
            {
                if (string.IsNullOrEmpty(Request.Form["Fecha"]))
                {
                    Retorno.Add("Debe seleccionar una Fecha");
                }
                if (string.IsNullOrEmpty(Request.Form["Nombre"]))
                {
                    Retorno.Add("Debe especificar un Nombre");
                }
                if (string.IsNullOrEmpty(Request.Form["Evaluacion"]))
                {
                    Retorno.Add("Debe especificar una Evaluacion");
                }

                if (Retorno.Count == 0)
                {
                    string  Correo   = (string)HttpContext.Session.GetString("correo");
                    NEvento bCarga   = new NEvento();
                    int     iRetorno = bCarga.Create(new EventModel()
                    {
                        id         = IdEvento,
                        start      = Request.Form["Fecha"].ToString(),
                        email      = Correo,
                        nombre     = Request.Form["Nombre"].ToString(),
                        evaluacion = int.Parse(Request.Form["Evaluacion"].ToString())
                    });
                    if (iRetorno == -99)
                    {
                        Retorno.Add("Ya existe una caliicación para el día seleccionado");
                    }
                }
            }
            catch (Exception ex)
            {
                Retorno.Add(ex.Message);
            }
            return(Json(new { Data = Retorno }));
        }