public ActionResult Edit(int id)
        {
            var selectList = new List <SelectListItem>();
            var planes     = _mapper.Map <IEnumerable <PlaneModelViewModel> >(_modelService.GetPlaneModels());

            foreach (var item in planes)
            {
                selectList.Add(new SelectListItem()
                {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }

            var editViewModel = new EditUserViewModel();

            editViewModel.User = _mapper.Map <UserViewModel>(_service.GetUsers().FirstOrDefault(x => x.Id == id));
            foreach (var plane in selectList)
            {
                foreach (var userPlane in editViewModel.User.PlaneModels)
                {
                    if (Convert.ToInt32(plane.Value) == userPlane.Id)
                    {
                        plane.Selected = true;
                    }
                }
            }
            editViewModel.SelectedIds = selectList;
            return(View("EditUser", editViewModel));
        }
        public ActionResult Index()
        {
            var list = _mapper.Map <IEnumerable <PlaneModelViewModel> >(_service.GetPlaneModels());

            ViewBag.ListOFModels = list;
            return(View(list));
        }
 public ActionResult Create()
 {
     ViewBag.PlaneModels = _mapper.Map <IEnumerable <PlaneModelViewModel> >(_modelService.GetPlaneModels());
     return(View("CreatePlanePart"));
 }