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)); }
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())); }