public ActionResult Create(CompteModel compteModel) { Agence a = new Agence(); AgenceService ass = new AgenceService(); ass.Add(a); ass.Commit(); String type = Request.Form["typeSelect"].ToString(); if (type == "Compte Courant") { Domaine.Entities.CompteCourant cc = new Domaine.Entities.CompteCourant(); cc.RIB = "123456789101"; cc.DateOuverture = DateTime.Now; cc.Solde = compteModel.Solde; cc.DecouvertMax = 0f; ccs.Add(cc); ccs.Commit(); } return(View()); }
public ActionResult Create(CompteViewModel cvm) { try { // TODO: Add insert logic here CompteCourantService CS = new CompteCourantService(); CompteCourant account = new CompteCourant() { AgenceKey = 1, CIN = cvm.CIN, DateOuverture = cvm.DateOuverture, Solde = cvm.Solde, DecouvertMax = 240f }; CS.Add(account); CS.Commit(); Session["Cin"] = cvm.CIN; return(RedirectToAction("Index")); } catch { return(View()); } }