public ActionResult EditProfile(ProfileViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                TempData["WarningMessage"] = "Please upload picture of type: PNG, GIF, or JPG.";
                return Redirect(returnUrl);
            }

            var currentUser = manager.FindById(User.Identity.GetUserId());

            currentUser.Sex = model.Sex;
            currentUser.Country = model.Country;
            currentUser.City = model.City;
            currentUser.About = model.About;
            currentUser.Age = model.Age;
            currentUser.Address = model.Address;

            if (model.File != null)
            {
                currentUser.ImageData = new byte[model.File.ContentLength];
                currentUser.ImageMimeType = model.File.ContentType;
                model.File.InputStream.Read(currentUser.ImageData, 0, model.File.ContentLength);
            }

            repository.UpdateProfile(currentUser);

            return RedirectToAction("EditProfile");
        }
        // GET: /Profile/EditProfile
        public ActionResult EditProfile()
        {
            var currentUser = manager.FindById(User.Identity.GetUserId());

            var model = new ProfileViewModel
            {
                FirstName = currentUser.FirstName,
                LastName = currentUser.LastName,
                Sex = currentUser.Sex,
                Country=currentUser.Country,
                City=currentUser.City,
                About=currentUser.About,
                Age=currentUser.Age,
                Address=currentUser.Address,
                Id=currentUser.Id,
            };

            return View(model);
        }
        public ActionResult EditUserProfile(ProfileViewModel model)
        {
            var user = manager.FindById(model.Id);

            user.Sex = model.Sex;
            user.Country = model.Country;
            user.City = model.Address;
            user.About = model.About;
            user.Age = model.Age;
            user.Address = model.Address;

            repository.UpdateProfile(user);

            TempData["InfoMessage"] = "User profile successfully updated";

            return Redirect(model.ReturnUrl);
        }
        // GET: ViewProfile
        public ActionResult ViewProfile(string id)
        {
            ApplicationUser currentUser;

            if(id==null)
                currentUser = manager.FindById(User.Identity.GetUserId());
            else
                currentUser = manager.FindById(id);

            var model = new ProfileViewModel
            {
                FirstName = currentUser.FirstName,
                LastName = currentUser.LastName,
                Sex = currentUser.Sex,
                Country = currentUser.Country,
                City = currentUser.City,
                Address = currentUser.Address,
                About = currentUser.About,
                Age = currentUser.Age,
                Id=currentUser.Id,
                FriendsCount=currentUser.Friends.Count,
            };

            return View(model);
        }
        //GET: EditUserProfile
        public ActionResult EditUserProfile(string id,string returnUrl)
        {
            var currentUser = manager.FindById(id);

            var model = new ProfileViewModel
            {
                Id=id,
                FirstName = currentUser.FirstName,
                LastName = currentUser.LastName,
                Sex = currentUser.Sex,
                Country = currentUser.Country,
                City = currentUser.City,
                About = currentUser.About,
                Age = currentUser.Age,
                Address = currentUser.Address,
                ReturnUrl=returnUrl,
            };

            return View(model);
        }