I have pretty simple query:
//user from UserManager from default AccountController from .net Identity
var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
var product = await Task.Run(()
=> db.WatchedProducts.Where(u => u.ApplicationUserId == user.Id && u.ProductId == id));
What i want to do is to find specific product in WatchedProducts list. Model of it looks like this:
public class WatchedProduct
{
[Key]
public int Id { get; set; }
[ForeignKey("ApplicationUser")]
public string ApplicationUserId { get; set; }
public virtual ApplicationUser ApplicationUser { get; set; }
[ForeignKey("Product")]
public int ProductId { get; set; }
public virtual Product Product { get; set; }
}
ApplicationUser have list of WatchedProducts.
My question is, why istead of getting WatchedProduct product i get an IQueryable<WatchedProduct> product?