Пример #1
0
        public ActionResult Index()
        {
            var viewmodel = new AdminViewModel
                                {
                                    Milestones =
                                        Mapper.Map<IEnumerable<Milestone>, IEnumerable<MilestoneViewModel>>(
                                            _unitOfWork.Milestones.Get()),
                                            CustomProfile =  CustomProfile.GetProfile(Profile.UserName),
                                };

            return View(viewmodel);
        }
Пример #2
0
        public ActionResult Milestone(Guid milestoneId, Guid? stepId)
        {
            var viewModel = new AdminViewModel
            {
                Milestones =
                    Mapper.Map<IEnumerable<Milestone>, IEnumerable<MilestoneViewModel>>(
                        _unitOfWork.Milestones.Get()),
                Steps = Mapper.Map<IEnumerable<Step>, IEnumerable<StepViewModel>>(
                        _unitOfWork.Steps.Get(s => s.MilestoneId == milestoneId).OrderBy(s => s.DisplayOrder)),

            };

            viewModel.SelectedMilestone = viewModel.Milestones.FirstOrDefault(m => m.MilestoneId == milestoneId);
            viewModel.SelectedStep = stepId == null ? viewModel.Steps.First() : viewModel.Steps.FirstOrDefault(s => s.StepId == stepId);
            return View(viewModel);
        }
Пример #3
0
 public ActionResult Milestone(AdminViewModel viewModel)
 {
     var entityToUpdate = _unitOfWork.Steps.GetById(viewModel.SelectedStep.StepId);
     entityToUpdate.Guidance = viewModel.SelectedStep.Guidance;
     _unitOfWork.Steps.Update(entityToUpdate);
     _unitOfWork.Commit();
     return View(viewModel);
 }