Пример #1
0
        public IActionResult Create()
        {
            var alternative = new AlternativeViewModel();

            alternative.Teachers = _teacherService.GetAllTeahers()
                                   .Select(x => _mapper.Map <Teacher, TeacherViewModel>(x))
                                   .Select(x => new SelectListItem(x.User.FullName, x.TeacherId.ToString()));
            return(View(alternative));
        }
Пример #2
0
        public IActionResult Create(AlternativeViewModel alternativeViewModel)
        {
            if (ModelState.IsValid)
            {
                var alternative = _mapper.Map <AlternativeViewModel, Model.Entities.Alternative>(alternativeViewModel);
                _alternativeService.Create(alternative);
            }

            return(View());
        }
Пример #3
0
        public ActionResult _Item(string id)
        {
            InitViewBag(null);

            var info = new AlternativeViewModel()
            {
                SeqNo     = 0,
                ProductID = id,
                IsDirty   = true
            };

            return(PartialView("_Item", info));
        }
Пример #4
0
 public static IEnumerable<AlternativeViewModel> ProjectAlternatives(Experiment experiment, Score score)
 {
     var index = 1;
     foreach (var alternative in experiment.Alternatives)
     {
         var value = alternative.ToString();
         var vm = new AlternativeViewModel
         {
             Name = "Option " + (char)(index + 64),
             Participants = experiment.ParticipantsByAlternative()[index],
             Converted = experiment.ConvertedByAlternative()[index],
             ConversionRate = experiment.ConversionRateByAlternative()[index],
             Showing = experiment.AlternativeValue.ToString() == value,
             Choice = score.Choice != null && score.Choice.Index == index,
             Value = value
         };
         index++;
         yield return vm;
     }
 }
Пример #5
0
        public static IEnumerable <AlternativeViewModel> ProjectAlternatives(Experiment experiment, Score score)
        {
            var index = 1;

            foreach (var alternative in experiment.Alternatives)
            {
                var value = alternative.ToString();
                var vm    = new AlternativeViewModel
                {
                    Name           = "Option " + (char)(index + 64),
                    Participants   = experiment.ParticipantsByAlternative()[index],
                    Converted      = experiment.ConvertedByAlternative()[index],
                    ConversionRate = experiment.ConversionRateByAlternative()[index],
                    Showing        = experiment.AlternativeValue.ToString() == value,
                    Choice         = score.Choice != null && score.Choice.Index == index,
                    Value          = value
                };
                index++;
                yield return(vm);
            }
        }