Esempio n. 1
0
        public JsonResult Verificar()
        {
            List <int> seleccion;

            using (var context = new DealersEntities())
            {
                string id = User.Identity.GetUserId();
                seleccion = context.Database.SqlQuery <int>("SELECT ID_Auto FROM Saved WHERE Id=@param1", new SqlParameter("param1", id)).ToList();
                // (@"SELECT ID_Auto FROM Saved WHERE Id= @param1", new SqlParameter("param1", (User.Identity.GetUserId()))).ToListAsync();
            }

            return(Json(seleccion, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult ListbyUser()
        {
            var user    = User.Identity.GetUserId();
            var compras = db.Compras.Include(c => c.AspNetUser).Include(c => c.Automovil).Include(c => c.Empleado);

            using (var context = new DealersEntities())
            {
                var model = from s in context.Compras
                            select s;

                if (!String.IsNullOrEmpty(user))
                {
                    compras = compras.Where(s => s.AspNetUser.Id.Contains(user));
                }
            }

            return(View(compras.ToList()));
        }