public IActionResult CreateFacture(FactureViewModel modelView) { if (ModelState.IsValid) { var facture = new Facture(); facture.Code = modelView.Code; facture.Date = modelView.Date; facture.City = modelView.City; facture.StatusID = modelView.StatusID; _context.Factures.Add(facture); _context.SaveChanges(); var product = new Product(); product.Price = modelView.Price; product.Count = modelView.Count; product.Tax = modelView.Tax; product.WareName = modelView.WareName; product.Id = facture.Id; _context.Products.Add(product); _context.SaveChanges(); return(RedirectToAction("Index")); } ViewData["StatusID"] = new SelectList(_context.Statuses, "Id", "StatusName", modelView.StatusID); return(View()); }
public FactureDetailPage(FactureViewModel viewModel) { InitializeComponent(); var factureStore = new SQLiteFacturStore(DependencyService.Get <ISQLiteDb>()); var pageService = new PageService(); Title = (viewModel.type_paiement == null) ? "New Facture" : "Edit Facture"; // BindingContext = new FactureDetailViewModel(viewModel ?? new FactureViewModel(), factureStore, pageService); }
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)); } }