コード例 #1
0
        //[AbpAuthorize(AppPermissions.Pages_Tenant_OnlineBooking_Project_GetListProjectByName)]
        public ListResultDto <ListProjectResultDto> GetListProjectByName(string projectName)
        {
            var detailList = (from A in _msProject.GetAll()
                              where A.projectName.Contains(projectName)
                              select new ListProjectResultDto
            {
                projectID = A.Id,
                projectName = A.projectName,
                projectCode = A.projectCode
            }).ToList();

            if (detailList == null)
            {
                var error = new List <ListProjectResultDto>();

                var message = new ListProjectResultDto
                {
                    message = "data not found"
                };

                error.Add(message);
                //throw new UserFriendlyException("data not found");
                return(new ListResultDto <ListProjectResultDto>(error));
            }
            else
            {
                return(new ListResultDto <ListProjectResultDto>(detailList));
            }
        }
コード例 #2
0
        //[AbpAuthorize(AppPermissions.Pages_Tenant_OnlineBooking_Project_GetListProject)]
        public ListResultDto <ListProjectResultDto> GetListProject()
        {
            var allList = (from A in _msProject.GetAll()
                           join b in _msProjectInfo.GetAll() on A.Id equals b.projectID into project
                           from b in project.DefaultIfEmpty()
                           select new ListProjectResultDto
            {
                projectID = A.Id,
                projectCode = A.projectCode,
                projectName = A.projectName,
                image = b.projectImageLogo
            }).ToList();

            if (allList == null)
            {
                var error = new List <ListProjectResultDto>();

                var message = new ListProjectResultDto
                {
                    message = "data not found"
                };

                error.Add(message);

                //throw new UserFriendlyException("data not found");
                return(new ListResultDto <ListProjectResultDto>(error));
            }
            else
            {
                return(new ListResultDto <ListProjectResultDto>(allList));
            }
        }