示例#1
0
        public async Task <FormModel> GetAsync(Guid id)
        {
            ValidateFormId(id);
            string[] properties     = { nameof(Form.IdOwnerNavigation), nameof(Form.IdKeyFormTypeNavigation) };
            var      existingEntity = await context
                                      .FormRepository
                                      .FirstOrDefaultAsync(x => x.IdForm.Equals(id), properties);

            if (existingEntity == null)
            {
                throw new TMNotFoundException(string.Format(ErrorMessages.ObjectNotFound, nameof(Form)));
            }

            return(mappingManager.Create(existingEntity));
        }
示例#2
0
        public async Task <List <OwnerModel> > GetOwnersByFilterAsync(OwnerFilter ownerFilter)
        {
            List <Owner> owners = await context.OwnerRepository.GetOwnersAsync(ownerFilter.Create());

            return(owners.Select(owner => mappingManager.Create(owner)).ToList());
        }