Esempio n. 1
0
        public async Task <IActionResult> Edit(Guid id)
        {
            var user = await _signInManager.UserManager.GetUserAsync(User);

            Fridge productInFridge = await fridgeRepository.FindAsync(f => f.Id == id && f.User == user);

            var products = await productRepository.Products();

            products = products.OrderBy(p => p.Name);
            return(View("Fridge", new FridgeViewModel
            {
                Id = productInFridge.Product.Id,
                Quantity = productInFridge.Quantity,
                Products = products,
                Fridges = await fridgeRepository.GetUserProducts(user)
            }));
        }