public async Task <DataResult <FamilyModel> > GetFamilyById(int id) { try { Family entity = await _familyRepository.GetById(id); if (entity == null) { return(new DataResult <FamilyModel> { Success = false, ErrorCode = ErrorCode.NotFound, }); } FamilyModel model = _mapper.Map(entity); return(new DataResult <FamilyModel> { Success = true, Data = model, }); } catch (Exception ex) { _logger.LogError(ex, $"Problems with getting Family by id : {id}"); return(new DataResult <FamilyModel> { Success = false, ErrorCode = ErrorCode.InternalError, }); } }
public ActionResult <Family> GetFamily(int id) { var family = _familyRepository.GetById(id); if (family == null) { return(NotFound()); } return(family); }
private Faw.Models.Domain.Family GetFamilyInternal(Guid familyId) { using (ContextScopeFactory.CreateReadOnly()) { var result = _familyRepository.GetById(familyId); result.CreatedBy = null; result.FamilyMemebers = null; return _familyRepository.GetById(familyId); } }
public Family Get(Guid familyId) { using (ContextScopeFactory.CreateReadOnly()) { return(Mapper.Map <Family>(_familyRepository.GetById(familyId))); } }
public Family GetFamily(Guid id) { return(_repository.GetById(id)); }