Esempio n. 1
0
        public CheckContinentViewModel GetCheckContinentModel(PostedCheckContinents postedCheckContinents)
        {
            Array.Clear(GlobVar.postedCheckCon, 0, GlobVar.postedCheckCon.Length);


            var model = new CheckContinentViewModel();
            var selectedCheckContinents = new List <CheckContinent>();
            var postedCheckContinentIds = new string[0];

            if (postedCheckContinents == null)
            {
                postedCheckContinents = new PostedCheckContinents();
            }


            if (postedCheckContinents.CheckContinentIds != null && postedCheckContinents.CheckContinentIds.Any())
            {
                postedCheckContinentIds = postedCheckContinents.CheckContinentIds;
                GlobVar.postedCheckCon  = postedCheckContinents.CheckContinentIds;
            }

            // if there are any selected ids saved, create a list of checkcontinents
            if (postedCheckContinentIds.Any())
            {
                selectedCheckContinents = CheckContinentRepository.GetAll()
                                          .Where(x => postedCheckContinentIds.Any(s => x.Id.ToString().Equals(s)))
                                          .ToList();
            }


            model.AvailableCheckContinents = CheckContinentRepository.GetAll().ToList();
            model.SelectedCheckContinents  = selectedCheckContinents;
            model.PostedCheckContinents    = postedCheckContinents;

            return(model);
        }
Esempio n. 2
0
 public ActionResult Play(PostedCheckContinents postedCheckContinents)
 {
     return(View(GetCheckContinentModel(postedCheckContinents)));
 }