public IActionResult Find() { try { var result = _muscularGroupsService.FindMuscularGroups(); return(new OkObjectResult(result)); // List<MuscularGroup> } catch (Exception exception) { return(BadRequest(new WebApiException("Error", exception))); } }
public IActionResult Index() { MuscularGroupViewModel muscularGroupViewModel; var muscularGroupsViewModels = new List <MuscularGroupViewModel>(); var muscularGroups = _muscularGroupsService.FindMuscularGroups(); if (muscularGroups != null) { foreach (var muscularGroup in muscularGroups) { muscularGroupViewModel = new MuscularGroupViewModel() { Id = muscularGroup.Id, Name = muscularGroup.Name }; muscularGroupsViewModels.Add(muscularGroupViewModel); } } ViewBag.MuscularGroups = muscularGroupsViewModels; return(View()); }
public IActionResult Create() { ViewBag.MuscularGroups = ControllerUtils.CreateSelectMuscularGroupItemList(_muscularGroupsService.FindMuscularGroups(), 0); return(View(new MuscleViewModel())); }