public CommandeViewModel() { Vendeur = new Vendeur(); Clientel = new ClientelViewModel(); Vendeurs = new List <SelectListItem>(); Clients = new List <SelectListItem>(); }
public CommandeViewModel(int noCommande, Vendeur vendeur, Clientel clientel, string date, bool facture) { NoCommande = noCommande; Vendeur = vendeur; Clientel = new ClientelViewModel(clientel); Date = date; Facture = facture; Vendeurs = new List <SelectListItem>(); Clients = new List <SelectListItem>(); }
public ActionResult Modifier(int?id) { ClientelViewModel clientVM = null; try { if (id == null) { throw new Exception(); } Clientel client = new ClientelDAO().GetSingleById((int)id); clientVM = new ClientelViewModel(client); } catch (Exception e) { ModelState.AddModelError("Erreur", "Erreur lors de la récupération du client : " + e.Message); } return(View(clientVM)); }
public ActionResult Save(ClientelViewModel clientVM) { try { new ClientelDAO().Update(new Clientel( clientVM.Id.ToString(), clientVM.Societe, clientVM.Nom, clientVM.Prenom, clientVM.Adresse, clientVM.Ville, clientVM.CodePostal )); //return View("~/Views/Client/Index.cshtml"); return(RedirectToAction("Index")); } catch (MonException exception) { return(View("~/Views/Shared/Error.cshtml")); } }