public ActionResult Edit(int id)
        {
            var member = _afiliadoRepo.GetById(id);

            var model = new EditAfiliadoModel
            {
                Active = _afiliadoRepo.ActiveUserLabel(member.statusAfiliado),
                Address = member.direccionAfiliado,
                City = member.idCiudad,
                Country = member.idPais,
                Email = member.emailAfiliado,
                IdAfiliado = member.idAfiliado,
                Name = member.nombreAfiliado,
                State = member.idEstado,
                UserType = _afiliadoRepo.UserTypeLabel(member.raizVal),
                ConfirmPassword = member.passwordAfiliado,
                Password = member.passwordAfiliado
            };

            ViewBag.Active = _afiliadoRepo.GetActiveMemberList(member.statusAfiliado);
            ViewBag.UserType = _afiliadoRepo.GetMemberTypeList(member.raizVal);
            ViewBag.Country = _paisRepo.GetCountries(member.idPais);
            ViewBag.City = _ciudadRepo.GetCities(member.idCiudad);
            ViewBag.State = _estadoRepo.GetStates(member.idEstado);

            return View(model);
        }
        public ActionResult Edit(EditAfiliadoModel model)
        {
            var member = _afiliadoRepo.GetById(model.IdAfiliado);

            if (model.PictureFile != null && model.PictureFile.ContentLength > 0)
            {
                var fileName = Path.GetFileName(model.PictureFile.FileName);
                if (fileName != null)
                {
                    var temp = "~/Content/dataImg/membersImages";
                    var name = member.idAfiliado.ToString(CultureInfo.InvariantCulture) + Path.GetExtension(model.PictureFile.FileName);
                    var path = Path.Combine(Server.MapPath(temp), name);
                    model.PictureFile.SaveAs(path);
                    temp += "/" + name;
                    member.imgPathAfiliado = temp;
                }
            }

            member.direccionAfiliado = model.Address;
            member.emailAfiliado = model.Email;
            member.fechaModiAfiliado = DateTime.Now;
            member.nombreAfiliado = model.Name;
            member.passwordAfiliado = model.Password;
            member.raizVal = _afiliadoRepo.UserTypeValue(model.UserType);
            member.statusAfiliado = _afiliadoRepo.ActiveUserValue(model.Active);

            member.idCiudad = model.City;
            //member.Ciudad = _ciudadRepo.Filter(x => x.idCiudad == model.City).First();
            member.idEstado = model.State;
            //member.Estado = _estadoRepo.Filter(x => x.idEstado == model.State).First();
            member.idPais = model.Country;
            //member.Pais = _paisRepo.Filter(x => x.idPais == model.Country).First();

            _afiliadoRepo.Update(member);

            return RedirectToAction("Index");
        }