public async Task <List <ProjectDTO> > ReadProjectsByUserId(int id)
        {
            var db = new CrowdFundingViva1Entities();
            List <ProjectDTO> resultList = new List <ProjectDTO>();

            resultList = await db.project.Select(s => new ProjectDTO
            {
                Project_Id        = s.project_id,
                Description       = s.description,
                User_Id           = s.user_id,
                Title             = s.title,
                Short_Description = s.short_description,
                Goal          = s.goal,
                Goal_Min      = s.goal_min,
                Photo_Id_Main = s.photo_id_main,
                Video         = s.video,
                Category_Id   = s.category_id,
                Due_Date      = s.due_date,
                Is_Active     = s.is_active,
                Created_Date  = s.created_date,
                Updated_Date  = s.updated_date,
                Deleted_Date  = s.deleted_date,
                Blocked_Date  = s.blocked_date,
                State_Id      = s.state_id,
                Website       = s.website
            }).Where(s => s.User_Id == id).ToListAsync();

            return(resultList);
        }
Beispiel #2
0
        public UserDTO ReadUserByName(string name)
        {
            var db = new CrowdFundingViva1Entities();

            UserDTO result = new UserDTO();

            user s = (from us in db.user
                      where us.username == name
                      select us).FirstOrDefault();

            result = new UserDTO
            {
                User_Id           = s.user_id,
                Password          = s.password,
                Firstname         = s.firstname,
                Lastname          = s.lastname,
                Username          = s.username,
                Email_Primary     = s.email_primary,
                Email_Secondary   = s.email_secondary,
                Telephone         = s.telephone,
                Mobile            = s.mobile,
                About             = s.about,
                Date_Of_Birth     = s.date_of_birth,
                Points            = s.points,
                Is_Active         = s.is_active,
                Registration_Date = s.registration_date,
                Deletion_Date     = s.deletion_date,
                Blocked_Date      = s.blocked_date,
                Is_Admin          = s.is_admin
            };

            return(result);
        }
        public async Task <List <ProjectPhotoDTO> > ReadProjectPhotoById(int id)
        {
            var db = new CrowdFundingViva1Entities();
            List <ProjectPhotoDTO> resultList = new List <ProjectPhotoDTO>();

            resultList = await db.project_photo.Select(s => new ProjectPhotoDTO
            {
                Photo_Id = s.photo_id,
                Photo    = s.photo
            }).Where(s => s.Photo_Id == id).ToListAsync();

            return(resultList);
        }
        public async Task <List <ProjectCategoryDTO> > ReadProjectCategories()
        {
            var db = new CrowdFundingViva1Entities();
            List <ProjectCategoryDTO> resultList = new List <ProjectCategoryDTO>();

            resultList = await db.project_category.Select(s => new ProjectCategoryDTO
            {
                Category_Id = s.category_id,
                Title       = s.title,
                Description = s.description
            }).ToListAsync();

            return(resultList);
        }