private void SaveProducts() { foreach (var prod in this.HandleDoublons()) { UserProducts entity = new UserProducts(); entity.IdProduct = prod.First.ID; entity.IdUser = this.Context.ApplicationUser.ID; entity.Quantity = prod.Second; UserProductsRepo.Insert(entity); } }
public RecipesViewModel(ApplicationContext context) { this.ClickCommand = new DelegateCommand(ClickAction, canClick); this.Context = context; this.UserProducts = UserProductsRepo.GetByUserId(this.Context.ApplicationUser.ID); this.ListProducts = new List <Product>(); foreach (var product in this.UserProducts) { this.ListProducts.Add(ProductRepo.GetById(product.IdProduct)); } this.ListRecettes = RecetteRepo.GetRecetteFromProducts(this.ListProducts); }