public IHttpActionResult GetNumberOfClients()
        {
            var clientList      = db.Clients.ToList().Select(x => ViewModelMapper.ToViewModelClients(x)).ToList();
            var numberOfClients = clientList.Count;

            return(Ok(numberOfClients));
        }
        public IHttpActionResult GetClient(int id)
        {
            Client client = db.Clients.Find(id);

            if (client == null)
            {
                return(NotFound());
            }

            return(Ok(ViewModelMapper.ToViewModelClients(client)));
        }
        public IHttpActionResult DeleteClient(int id)
        {
            Client client = db.Clients.Find(id);

            if (client == null)
            {
                return(NotFound());
            }

            db.Clients.Remove(client);
            db.SaveChanges();

            return(Ok(ViewModelMapper.ToViewModelClients(client)));
        }
        public IHttpActionResult PostClient(ClientViewModel clientViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Client client = ViewModelMapper.ToModelClients(clientViewModel);

            db.Clients.Add(client);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = client.ClientId }, ViewModelMapper.ToViewModelClients(client)));
        }
 // GET: api/ClientsApi
 public List <ClientViewModel> GetClients()
 {
     return(db.Clients.ToList().Select(x => ViewModelMapper.ToViewModelClients(x)).ToList());
 }