public ComptePage() { InitializeComponent(); _viewModel = new CompteViewModel(FactoryController.CreateLocataire()); BindingContext = _viewModel; }
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()); } }
// GET: Compte public ActionResult Index() { string cin = Session["Cin"].ToString(); ClientService CS = new ClientService(); Client client = CS.GetAll().FirstOrDefault(c => c.CIN.Equals(cin)); List <CompteViewModel> lcvm = new List <CompteViewModel>(); foreach (var compte in client.Comptes) { CompteViewModel cvm = new CompteViewModel() { RIB = compte.RIB, DateOuverture = compte.DateOuverture, Solde = compte.Solde, CIN = compte.CIN, AgenceKey = compte.AgenceKey }; lcvm.Add(cvm); } ViewData["FirstName"] = client.FullName.FirstName; ViewData["LastName"] = client.FullName.LastName; return(View(lcvm)); }
public ComptePage() { InitializeComponent(); BindingContext = new CompteViewModel(); }