public ActionResult Edit(EditPlayerViewModel model)
        {
            if (ModelState.IsValid)
            {
                playerService.Save(model.Player);
                playerService.Commit();

                SuccessMessage(FormMessages.SaveSuccess);
            }

            PopulateHeightLists(model);

            return View(model);
        }
        public ActionResult Edit(int id)
        {
            Player playerToEdit = playerService.Get(id, membershipService.GetLoggedInUser().Team.Id);

            if (playerToEdit == null)
                return RedirectToAction("Index");

            EditPlayerViewModel model = new EditPlayerViewModel()
            {
                Player = playerToEdit
            };

            PopulateHeightLists(model);

            return View(model);
        }
        private void PopulateHeightLists(EditPlayerViewModel model)
        {
            List<SelectListItem> heightList = new List<SelectListItem>();

            // Feet
            for (int i = 4; i <= 7; i++)
                heightList.Add(new SelectListItem() { Text = i.ToString(), Value = i.ToString() });

            model.HeightFeet = heightList.ToSelectListWithHeader(x => x.Text,
                x => x.Value.ToString(),
                model.HeightFeet != null ? model.HeightFeet.ToString() : "");

            // Inches
            heightList.Clear();
            for (int i = 1; i <= 11; i++)
                heightList.Add(new SelectListItem() { Text = i.ToString(), Value = i.ToString() });

            model.HeightInches = heightList.ToSelectListWithHeader(
                x => x.Text,
                x => x.Value.ToString(),
                model.HeightInches != null ? model.HeightInches.ToString() : "");
        }