public ActionResult Index(UserViewModel user)
 {
     foreach (var per in user.people)
     {
         per.UserID = user.ID;
         service.Update(per);
     }
     return RedirectToAction("Index");
 }
        public ActionResult AddPicture(UserViewModel user, HttpPostedFileBase uploadImage)
        {
            if (uploadImage != null)
            {
                UserViewModel userOld = service.GetUserByID(User.Identity.GetUserId());
                byte[] imageData = null;
                using (var binaryReader = new BinaryReader(uploadImage.InputStream))
                {
                    imageData = binaryReader.ReadBytes(uploadImage.ContentLength);
                }
                userOld.Image = imageData;
                service.UserOnluUpdate(userOld);
            }

            return RedirectToAction("Index");
        }
 public void Delete(UserViewModel user)
 {
     User User = Mapper.Map<User>(user);
     repository.Delete(User);
 }
 public void Add(UserViewModel user)
 {
     User User = Mapper.Map<User>(user);
     repository.Create(User);
 }
 public void UserOnluUpdate(UserViewModel user)
 {
     User User = Mapper.Map<User>(user);
     //User.people = null;
     repository.Update(User);
 }
 public void Update(UserViewModel user)
 {
     User User = Mapper.Map<User>(user);
     repository.Update(User);
 }
 public ActionResult Index(UserViewModel user, HttpPostedFileBase uploadImage)
 {
     service.Update(user);
     return RedirectToAction("Index");
 }