public async Task <IActionResult> Edit(int id) { DataResult <GenusModel> result = await _genusService.GetGenusById(id); ViewBag.Families = new SelectList( (await _familyRepository.GetAll()).OrderBy(e => e.Denomination), nameof(Genus.Id), nameof(Genus.Denomination)); if (result.Success) { return(View("Edit", result.Data)); } return(RedirectToAction("Error", "Error", new { result.ErrorCode, modelName = nameof(Genus) })); }
public List <FamilyDto> GetAll(bool getOnlyActive) { List <FamilyDto> result = new List <FamilyDto>(); try { if (!getOnlyActive) { result = familyRepository.GetAll().Select(c => new FamilyDto(c)).ToList(); } else { result = familyRepository.GetAll().Where(c => c.IsActive).Select(c => new FamilyDto(c)).ToList(); } return(result); } catch (Exception ex) { return(new List <FamilyDto>()); } }
public IEnumerable <Family> GetAll() { return(_familyRepository.GetAll()); }
public IQueryable <Family> GetFamilys() { return(_repository.GetAll()); }
public ActionResult <IEnumerable <Family> > GetFamilies() { return(_familyRepository.GetAll().ToList()); }
public FamilyQuery(IFamilyRepository familyRepository) { Field <ListGraphType <FamilyType> >( "families", resolve: c => familyRepository.GetAll()); }