public ActionResult Complet(CompletViewModels model) { // Get all states again var communes = GetAllStates(); // Set these states on the model. We need to do this because // only the selected value from the DropDownList is posted back, not the whole // list of states. model.Communes = GetSelectListItems(communes); Random rnd = new Random(); model.IdComplet = rnd.Next(1, 9999); // recovery of the ip address string hote = Dns.GetHostName(); IPHostEntry iphe = Dns.Resolve(hote); string ip = iphe.AddressList[0].ToString(); if (ModelState.IsValid) { Session["CompletViewModels"] = model; CompletManager.GetExtraitComplet(model.IdComplet, model.Name, model.Firstname, model.Adress, model.Email, model.Tel, model.Commune, model.Parcelle, model.Proprietaire, model.NameProprietaire, model.FirstnameProprietaire, model.Annexe, model.Remarque); Logs.Logs.LogExtraitComplet(model.IdComplet + " - " + model.Name + " " + model.Firstname + ", Tél : " + model.Tel + ", Commune de " + model.Commune + " Parcelle n° " + model.Parcelle, model.Email, ip); ViewBag.Success = true; ViewBag.Message = "La commande a été transmise !"; return(RedirectToAction("Done")); } else { ViewBag.Message = "La transmission de la demande a échouée"; return(View("Complet", model)); } }
public ActionResult Complet() { ViewBag.Title = "Extrait complet du registre foncier"; // Let's get all states that we need for a DropDownList var communes2 = GetAllStates(); var model2 = new CompletViewModels(); // Create a list of SelectListItems so these can be rendered on the page model2.Communes = GetSelectListItems(communes2); return(View(model2)); }