public ActionResult Edit([Bind(Include = "Id,Name,LastName,Email,Password,BirthDate,ContactNumber")] ClientViewModel clientVM, FormCollection form)
        {
            var cityId = Convert.ToInt32(form["City"]);

            if (db.Cities.Any(c => c.Id == cityId))
            {
                var city = db.Cities.First(c => c.Id == cityId);
                clientVM.City = city;
            }

            var mapper = new ClientMapper();

            var client = mapper.ClientViewModelToClient(clientVM);

            if (ModelState.IsValid)
            {
                db.Entry(client).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(clientVM));
        }
        public ActionResult Create([Bind(Include = "Id,Name,LastName,Email,Password,BirthDate,ContactNumber")] ClientViewModel clientVM, FormCollection form)
        {
            var cityId = Convert.ToInt32(form["City"]);

            if (db.Cities.Any(c => c.Id == cityId))
            {
                var city = db.Cities.First(c => c.Id == cityId);
                clientVM.City = city;
            }

            var mapper = new ClientMapper();

            var client = mapper.ClientViewModelToClient(clientVM); //éste método se utiliza para convertir el objeto ClientViewModel en un objeto Client

            if (ModelState.IsValid)
            {
                db.Clients.Add(client);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(clientVM));
        }