public IActionResult Index() { var trainings = trainingManager.GetAll(); //Mapper.Initialize(cfg => cfg.CreateMap<Training, TrainingViewModel>().ForMember(m => m.MuscleCategories, o => o.MapFrom(s => s.MuscleCategories.Select(r => r.MuscleCategory)))); var collection = new List <TrainingViewModel>(); foreach (var item in trainings) { collection.Add(Mapper.Map <Training, TrainingViewModel>(item)); } return(View(collection)); }
public IEnumerable <TrainingViewModel> Get() { var trainings = trainingManager.GetAll(); var vmTrainings = new List <TrainingViewModel>(); foreach (var training in trainings) { vmTrainings.Add(Mapper.Map <Training, TrainingViewModel>(training)); } return(vmTrainings); }
public IActionResult Create() { ViewData["BatchScheduleId"] = new SelectList(_IScedhuleTypeManager.GetAll(), "Id", "Name"); ViewData["TrainingId"] = new SelectList(_iTrainingManager.GetAll(), "Id", "Name"); return(View()); }