protected async void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (txtTitulo.Text != "" && txtDescripcion.Text != "" && ddlFechas.SelectedIndex > -1 &&
                file.HasFile == true)
            {
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri(this.RutaApi);
                str.Event evento = new str.Event();
                evento.id          = Guid.NewGuid().ToString();
                evento.date        = ddlFechas.SelectedItem.Text;
                evento.title       = txtTitulo.Text;
                evento.description = txtDescripcion.Text;
                string path = ConfigurationManager.AppSettings["images"].ToString() + file.FileName;
                evento.image = path;
                file.SaveAs(Server.MapPath(path));
                HttpResponseMessage message = await client.PostAsJsonAsync <str.Event>(client.BaseAddress + "api/events", evento);

                if (message.IsSuccessStatusCode)
                {
                    string id = await message.Content.ReadAsStringAsync();

                    ScriptManager.RegisterStartupScript(this, GetType(), "NuevoEvento",
                                                        "alert('" + id + "');", true);
                }
                else
                {
                    string error = await message.Content.ReadAsStringAsync();

                    ScriptManager.RegisterStartupScript(this, GetType(), "NuevoEvento",
                                                        "alert('" + error + "');", true);
                }
            }
        }
        public async Task <ActionResult <string> > nuevoEvento(str.Event evento)
        {
            string id = string.Empty;

            try
            {
                //if (UsuarioLogueado() == false)
                //    return StatusCode(StatusCodes.Status401Unauthorized, "Acceso denegado");

                if (DateTime.Parse(evento.date) < DateTime.UtcNow)
                {
                    return(StatusCode(StatusCodes.Status303SeeOther, "La Fecha del evento no debe de ser menor al día de hoy."));
                }
                id = await this.eventRepositorio.nuevoEvento(evento);

                return(Ok("Evento registrado correctamente con id: " + id));
            }
            catch (SqlException ex)
            {
                return(StatusCode(StatusCodes.Status303SeeOther, ex.Message));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Datos inválidos."));
            }
        }