Ejemplo n.º 1
0
        public async Task <IActionResult> OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            // Set the order of the products correctly
            if (Vm.Products.Any())
            {
                for (int i = 0; i < Vm.Products.Count; i++)
                {
                    Vm.Products[i].DisplayOrder = i;
                }
            }

            await _eventManagementService.UpdateEventProductsAsync(Vm.EventInfoId, Vm.Products);

            return(RedirectToPage("./Details", new { id = Vm.EventInfoId }));
        }