public ActionResult Create([Bind(Include = "ID,Nom,Default,Solde,Adresse,Telephone,Email,NomUrgence,AddresseUrgence,TelephoneUrgence,PhotosAllowed,CertficatMedical,DateNaissance,LieuNaiss")] Client client) { if (ModelState.IsValid) { if (ClientManager.AddClient(client)) { return(RedirectToAction("Index")); } } return(View(client)); }
public void DeleteClientTest() { Client client = new Client(); client.Name = "user3"; client.Password = "******"; ClientDAO clientDAO = new ClientDAO(); clientDAO.AddClient(client); client = clientDAO.GetClient(client.Name); clientDAO.DeleteClient(client.Id); client = clientDAO.GetClient(client.Name); Assert.IsNull(client); }
public ActionResult ClientCreate(Client c) { try { if (cli.AddClient(c)) { return(RedirectToAction("ClientIndex")); } else { return(View("ClientCreate")); } } catch { return(View("ClientCreate")); } }
public void UpdateClientTest() { Client client = new Client(); client.Name = "user2"; client.Password = "******"; ClientDAO clientDAO = new ClientDAO(); clientDAO.AddClient(client); client = clientDAO.GetClient(client.Name); client.Password = "******"; clientDAO.UpdateClient(client); Client client1 = clientDAO.GetClient(client.Name); string expected = ToStringWithoutId(client); string actual = ToStringWithoutId(client1); Assert.AreEqual(expected, actual); }
public void AddClientTest() { Client client = new Client(); client.Name = "user1"; client.Password = "******"; ClientDAO clientDAO = new ClientDAO(); clientDAO.AddClient(client); string expected = ToStringWithoutId(client); Client client1 = clientDAO.GetClient(client.Name); if (client1 == null) { Assert.Fail(); } string actual = ToStringWithoutId(client1); Assert.AreEqual(expected, actual); }
public void AddClient(Client cli) { cliDao.AddClient(cli); }