コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public ActionResult ClientCreate(Client c)
 {
     try
     {
         if (cli.AddClient(c))
         {
             return(RedirectToAction("ClientIndex"));
         }
         else
         {
             return(View("ClientCreate"));
         }
     }
     catch
     {
         return(View("ClientCreate"));
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 public void AddClient(Client cli)
 {
     cliDao.AddClient(cli);
 }