コード例 #1
0
        // GET: Produits/Commande
        public ActionResult Commande()
        {
            List <Produit> produits = db.Produits.Include(p => p.Categorie).Include(p => p.Restaurant).Where(p => p.Quantite > 0).ToList();
            PanierModel    panier   = (PanierModel)HttpContext.Application[Session.SessionID] ?? new PanierModel();

            CommandeViewModel commandeViewModel = new CommandeViewModel()
            {
                ProduitsDisponible = produits,
                Panier             = panier
            };

            return(View(commandeViewModel));
        }
コード例 #2
0
        public ActionResult Guid(string id)
        {
            Facture facture = new FactureDAL().Details(id);

            if (facture != null)
            {
                Commande          commande   = new CommandeDAL().Detail(facture.CommandeId);
                CommandeViewModel commandeVM = new CommandeViewModel(commande);
                FactureViewModel  factureVM  = new FactureViewModel(commandeVM);
                ViewBag.FactureId = facture.Id;
                return(View(factureVM));
            }
            else
            {
                return(View(null as FactureViewModel));
            }
        }
コード例 #3
0
        public IActionResult ConsulterCommande()
        {
            List <CommandeViewModel> commandeViewModels = new List <CommandeViewModel>();
            CommandeViewModel        commande           = new CommandeViewModel();

            commande.DateCommande   = new DateTime();
            commande.NumeroCommande = "11111111111";
            ProduitViewModel produit = new ProduitViewModel();

            produit.NomProduit    = "test1";
            produit.NumeroProduit = "1111";
            produit.Quantite      = 4;
            produit.Prix          = 1000.5;
            commande.Produit      = produit;
            commandeViewModels.Add(commande);
            return(View(commandeViewModels));
        }
コード例 #4
0
        public ActionResult Create(CommandeViewModel cmdVM, string type)
        {
            user     currentUser = SessionPersister.User;
            var      StockCtrl   = new GestionStock();
            commande cmd         = new commande();

            cmd.address      = cmdVM.Commande.address;
            cmd.country      = cmdVM.Commande.country;
            cmd.qteOfProduct = cmdVM.Commande.qteOfProduct;
            cmd.totalPrice   = 0;
            cmd.status       = 0;
            cmd.ordered      = DateTime.Now;//.ToString("yyyy-MM-dd HH:mm:ss");
            cmd.Admin        = currentUser.id;
            cmd.Provider     = cmdVM.PostedProviderId;
            cmd.Stock        = 1;

            /*//stock currentStock =  StockCtrl.FindByCondition(p=>p.stockType.Equals(type)).First();
             * commande cmd = new commande();//cmdVM.Commande;
             * provider prv = new provider();
             * GestionProvider gProvider = new GestionProvider();
             * prv = gProvider.FindById(cmdVM.PostedProviderId);
             * cmd.Admin1= (Admin)currentUser;
             * //cmd.Admin1 =(Admin) currentUser;
             * //cmd.stock1 = currentStock;
             * //cmd.provider1 = prv;
             *
             * cmd.totalPrice=0;
             * cmd.status=0;*/
            if (ModelState.IsValid)
            {
                gCommandes.Create(cmd);
                gCommandes.Commit();
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(cmd));
            }
        }