Esempio n. 1
0
        // GET: api/clients
        public List <clientViewModel> Getclients()
        {
            //return db.clients;
            List <clientViewModel> rep = new List <clientViewModel>();
            var cm = db.clients.ToList();

            foreach (var n in cm)
            {
                clientViewModel rvm = new clientViewModel();
                rvm.idClient = n.idClient;
                rvm.nom      = n.nom;
                rvm.photo    = n.photo;
                rvm.prenom   = n.prenom;
                rvm.date     = n.date;
                //rvm.username = n.username;
                //rvm.password = n.password;

                rep.Add(rvm);
            }

            return(rep);
        }
Esempio n. 2
0
        public IHttpActionResult Getclients(int id)
        {
            clients         clients = db.clients.Find(id);
            clientViewModel rvm     = new clientViewModel();

            if (clients == null)
            {
                return(NotFound());
            }
            else
            {
                rvm.idClient = clients.idClient;
                rvm.nom      = clients.nom;

                rvm.photo  = clients.photo;
                rvm.prenom = clients.prenom;
                rvm.date   = clients.date;
                //rvm.username = clients.username;
                //rvm.password = clients.password;

                return(Ok(rvm));
            }
        }