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)); }
public IActionResult Create(AlternativeViewModel alternativeViewModel) { if (ModelState.IsValid) { var alternative = _mapper.Map <AlternativeViewModel, Model.Entities.Alternative>(alternativeViewModel); _alternativeService.Create(alternative); } return(View()); }
public ActionResult _Item(string id) { InitViewBag(null); var info = new AlternativeViewModel() { SeqNo = 0, ProductID = id, IsDirty = true }; return(PartialView("_Item", info)); }
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; } }
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); } }