Ejemplo n.º 1
0
        //public ActionResult Edit(
        // [Bind(Prefix="Race.Conditions",Include = "RaceConditionsId,SwimLayout,BikeLayout,RunLayout")] RaceConditions raceConditions)
        public ActionResult Edit(SimpleRaceConditionsViewModel viewModel, string raceId)
        {
            var race = db.Races.Find(raceId);

            if (String.IsNullOrEmpty(raceId))
            {
                return(HttpNotFound());
            }

            Save(race.Conditions, viewModel);

            return(RedirectToAction("admin", "races"));
        }
Ejemplo n.º 2
0
        //public ActionResult Edit(
        // [Bind(Prefix="Race.Conditions",Include = "RaceConditionsId,SwimLayout,BikeLayout,RunLayout")] RaceConditions raceConditions)
        public ActionResult EditAll(SimpleRaceConditionsViewModel postedModel)
        {
            if (ModelState.IsValid)
            {
                Save(postedModel);
                return(RedirectToAction("Index"));
            }

            var tagviewModel = new TagViewModel();

            tagviewModel.Tags = db.Tags.ToList();

            return(View("EditAll", tagviewModel));
        }
Ejemplo n.º 3
0
        private void Save(RaceConditions conditions, SimpleRaceConditionsViewModel viewModel)
        {
            Save(conditions, conditions.SwimLayout, viewModel.selectedSwimLayout, TagType.SwimLayout);
            Save(conditions, conditions.SwimMedium, viewModel.selectedSwimMedium, TagType.SwimMedium);
            Save(conditions, conditions.SwimOther, viewModel.selectedSwimOther, TagType.SwimOther);
            Save(conditions, conditions.SwimWeather, viewModel.selectedSwimWeather, TagType.SwimWeather);


            Save(conditions, conditions.BikeLayout, viewModel.selectedBikeLayout, TagType.BikeLayout);
            Save(conditions, conditions.BikeMedium, viewModel.selectedBikeMedium, TagType.BikeMedium);
            Save(conditions, conditions.BikeOther, viewModel.selectedBikeOther, TagType.BikeOther);
            Save(conditions, conditions.BikeWeather, viewModel.selectedBikeWeather, TagType.BikeWeather);


            Save(conditions, conditions.RunLayout, viewModel.selectedRunLayout, TagType.RunLayout);
            Save(conditions, conditions.RunMedium, viewModel.selectedRunMedium, TagType.RunMedium);
            Save(conditions, conditions.RunOther, viewModel.selectedRunOther, TagType.RunOther);
            Save(conditions, conditions.RunWeather, viewModel.selectedRunWeather, TagType.RunWeather);
        }