Пример #1
0
        public async Task <ActionResult <Company_CompanyActivityDTO> > GetActivity([FromBody] Company_CompanyActivityDTO Company_CompanyActivityDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CompanyActivity CompanyActivity = await CompanyActivityService.Get(Company_CompanyActivityDTO.Id);

            return(new Company_CompanyActivityDTO(CompanyActivity));
        }
Пример #2
0
        public async Task <ActionResult <int> > CountActivity([FromBody] Company_CompanyActivityFilterDTO Company_CompanyActivityFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CompanyActivityFilter CompanyActivityFilter = ConvertFilterDTOToFilterEntity(Company_CompanyActivityFilterDTO);

            CompanyActivityFilter = await CompanyActivityService.ToFilter(CompanyActivityFilter);

            int count = await CompanyActivityService.Count(CompanyActivityFilter);

            return(count);
        }
Пример #3
0
        public async Task <ActionResult <List <Company_CompanyActivityDTO> > > ListActivity([FromBody] Company_CompanyActivityFilterDTO Company_CompanyActivityFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CompanyActivityFilter CompanyActivityFilter = ConvertFilterDTOToFilterEntity(Company_CompanyActivityFilterDTO);

            CompanyActivityFilter = await CompanyActivityService.ToFilter(CompanyActivityFilter);

            List <CompanyActivity> CompanyActivities = await CompanyActivityService.List(CompanyActivityFilter);

            List <Company_CompanyActivityDTO> Company_CompanyActivityDTOs = CompanyActivities
                                                                            .Select(c => new Company_CompanyActivityDTO(c)).ToList();

            return(Company_CompanyActivityDTOs);
        }