Exemple #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,UseFileId,UserId,Title,DOPublish")] EVideo eVideo)
        {
            if (id != eVideo.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(eVideo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EVideoExists(eVideo.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(eVideo));
        }
Exemple #2
0
    protected void btn_Subir_Click(object sender, EventArgs e)
    {
        ClientScriptManager cm = this.ClientScript;
        String archivo         = "~\\Videos\\" + System.IO.Path.GetFileName(fu_video.PostedFile.FileName);

        fu_video.PostedFile.SaveAs(Server.MapPath(archivo));
        nombre    = fu_video.FileName;
        extension = archivo;
        //System.IO.Path.GetExtension(fu_video.PostedFile.FileName);
        EVideo video = new EVideo();

        video.Id_usuario = ((EDatos)Session["valida"]).Id;
        video.Nombre     = nombre;
        video.Url        = extension;

        DaoUsuario dao = new DaoUsuario();

        dao.insertarVideo(video);

        if (video != null)
        {
            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert ('Video registrado satisfactoriamente' );</script>");
            return;
        }
    }
Exemple #3
0
 public void insertarVideo(EVideo video)
 {
     using (var db = new Mapeo())
     {
         db.video.Add(video);
         db.SaveChanges();
     }
 }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("Id,UseFileId,UserId,Title,DOPublish")] EVideo eVideo)
        {
            if (ModelState.IsValid)
            {
                eVideo.Id = Guid.NewGuid();
                _context.Add(eVideo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(eVideo));
        }