示例#1
0
        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,
                });
            }
        }
示例#2
0
        public ActionResult <Family> GetFamily(int id)
        {
            var family = _familyRepository.GetById(id);

            if (family == null)
            {
                return(NotFound());
            }

            return(family);
        }
示例#3
0
        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));
 }