예제 #1
0
 public ActionResult Registrar(usuario newuser, string repass)
 {
     if(ModelState.IsValid)
     {
         ConectorDataContext db = new ConectorDataContext();
         newuser.fecha = DateTime.Now;
         db.usuarios.InsertOnSubmit(newuser);
         db.SubmitChanges();
         return RedirectToAction("exito","Usuario");
     }
     return View();
 }
예제 #2
0
 public ActionResult Registrar(contenido aa)
 {
     if(ModelState.IsValid)
     {
         ConectorDataContext db = new ConectorDataContext();
         aa.fecha = DateTime.Now;
         aa.idUs = Convert.ToInt32(aa.idUs);
         db.contenidos.InsertOnSubmit(aa);
         db.SubmitChanges();
         return RedirectToAction("articulos","Contenido");
     }
     return View();
 }
예제 #3
0
 public ActionResult articulos()
 {
     ConectorDataContext db = new ConectorDataContext();
     List<Publicaciones> lista = db.contenidos.
         OrderByDescending(a => a.id).
         Where(a => a.idUs == a.usuario.id).
         Select(a => new Publicaciones()
         {nickname=a.usuario.nickname,
             email=a.usuario.email,
             idC=a.id,content=a.content,
             fecha=a.fecha}).ToList();
     ViewBag.lista = lista;
     return View();
 }
예제 #4
0
        public JsonResult publicarcomentarios(comentario cc)
        {
            cc.fecha = DateTime.Now;
            cc.idUs = 1;

            ConectorDataContext db = new ConectorDataContext();
            db.comentarios.InsertOnSubmit(cc);
            db.SubmitChanges();
            rendercomentario obj = new rendercomentario()
            {
                nickname=db.usuarios.Where(a=>a.id==cc.idUs).First().nickname,
                content=cc.content,
                fecha=cc.fecha.ToShortTimeString(),
                email = db.usuarios.Where(a => a.id == cc.idUs).First().email
            };
            return Json(new {data=obj});
        }
예제 #5
0
 public ActionResult Registrar()
 {
     ConectorDataContext db = new ConectorDataContext();
     ViewBag.id=db.usuarios.OrderByDescending(a => a.id).First().id;
     return View();
 }