コード例 #1
0
        public virtual ActionResult CreateFlightProgram(FlightProgramViewModel flightProgramViewModel)
        {
            this.Validate(flightProgramViewModel, string.Empty);
            if (!ModelState.IsValid)
            {
                return(View(Views.CreateFlightProgram, flightProgramViewModel));
            }
            var flightProgram = Mapper.Map <FlightProgramViewModel, FlightProgram>(flightProgramViewModel);

            flightProgram = flightProgramsRepository.AddNewFlightProgram(flightProgram);
            return(RedirectToAction(MVC.FlightPrograms.EditFlightProgram(flightProgram.Id.Value)));
        }
コード例 #2
0
        public virtual ActionResult EditFlightProgram(Guid id, FlightProgramViewModel flightProgramViewModel)
        {
            var flightProgram = Repository.Get <FlightProgram>(id);

            this.Validate(flightProgramViewModel, string.Empty);
            if (!ModelState.IsValid)
            {
                var viewModel = Mapper.Map <FlightProgram, FlightProgramViewModel>(flightProgram);
                return(View(Views.EditFlightProgram, viewModel));
            }
            Mapper.Map <FlightProgramViewModel, FlightProgram>(flightProgramViewModel, flightProgram);
            return(this.RedirectToSuccess(MVC.FlightPrograms.EditFlightProgram(id)));
        }