Update InvoiceController.cs
This commit is contained in:
		@@ -178,6 +178,13 @@ public class InvoiceController : Controller {
 | 
			
		||||
 | 
			
		||||
        inv.Products = new();
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            prods = _context.Products.Where(x => sinv.ProdQuant.Select(x => x.Key).Contains(x.Id)).ToList();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            _logger.LogError(8, e.Message);
 | 
			
		||||
            return BadRequest();
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        foreach (var prod in prods) {
 | 
			
		||||
            inv.Products.Add(new() {
 | 
			
		||||
                Product = prod,
 | 
			
		||||
@@ -267,13 +274,6 @@ public class InvoiceController : Controller {
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        inv.ShippingAddress = ad;
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            prods = _context.Products.Where(x => sinv.ProdQuant.Select(x => x.Key).Contains(x.Id)).ToList();
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            _logger.LogError(8, e.Message);
 | 
			
		||||
            return BadRequest();
 | 
			
		||||
        }
 | 
			
		||||
       
 | 
			
		||||
        if (prods.Count == 0)
 | 
			
		||||
            return BadRequest("Vous devez inclure au moins un produit à votre commande.");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user