public ActionResult comentarios(int bus,string Email, string Comentario, buscar model) { model.idPublicacion = bus; model.UserId = (Guid)Membership.GetUser().ProviderUserKey; model.Email = Email; model.Comentario = Comentario; model.comentario(model); return RedirectToAction("libro","Home"); }
public void comentario(buscar model) { DataClasses1DataContext db = new DataClasses1DataContext(); comentarios c = new comentarios() { contenido=model.Comentario, vistobueno="false", fecha_publicacion=DateTime.Now, idPublicacion = model.idPublicacion, UserId=model.UserId }; db.comentarios.InsertOnSubmit(c); db.SubmitChanges(); }
public ActionResult libro(string buscarr,buscar model) { DataClasses1DataContext db = new DataClasses1DataContext(); //publicacion pe = new publicacion(); perfilusers u = new perfilusers(); categoria c = new categoria(); categorizacion cat = new categorizacion(); var pe = (from b in db.publicacion join l in db.libro on b.idPublicacion equals l.idPublicacion where b.idPublicacion == l.idPublicacion && b.titulo == buscarr && b.correcciones=="true" select b).ToList(); if (pe != null) { var lib = (from l in db.publicacion where l.titulo == buscarr select l).ToArray()[0]; ViewBag.p = (from l in db.publicacion where l.titulo == buscarr select l).ToList(); ViewBag.u = (from s in db.perfilusers where s.UserId == lib.UserId select s).ToList(); model.idPublicacion = (int)lib.idPublicacion; model.UserId = lib.UserId; comentario co = new comentario(); try { co = (from m in db.comentario where m.titulo == buscarr select m).ToArray()[0]; // if (co != null) //{ ViewBag.comentario = from m in db.comentario where m.titulo == buscarr select m; } catch (Exception) { ViewBag.comentario2 = "Contenido sin comentarios"; } } else { ViewBag.error = "Sin contenido"; } return View(); //return View(); }