示例#1
0
        public async Task <Model.survey.Survey> Get(Model.survey.Survey survey)
        {
            var resultSurvey = await KoohTajrobeDbContext.Set <Model.survey.Survey>()
                               .FirstOrDefaultAsync(x => x.Id == survey.Id);

            return(resultSurvey);
        }
示例#2
0
        public async Task Delete(Model.survey.Survey survey)
        {
            var result = await KoohTajrobeDbContext.Set <Model.survey.Survey>()
                         .FirstOrDefaultAsync(x => x.Id == survey.Id);

            KoohTajrobeDbContext.Set <Model.survey.Survey>().Remove(result);
        }
示例#3
0
        public async Task DeleteSurveyRowDetail(SurveyRowDetail surveyRowDetail)
        {
            var result = await KoohTajrobeDbContext.Set <SurveyRowDetail>()
                         .FirstOrDefaultAsync(x => x.Id == surveyRowDetail.Id);

            KoohTajrobeDbContext.Set <SurveyRowDetail>().Remove(result);
        }
示例#4
0
        public async Task UpdateSurveyRowDetail(SurveyRowDetail surveyRowDetail)
        {
            var result = await KoohTajrobeDbContext.Set <SurveyRowDetail>()
                         .FirstOrDefaultAsync(x => x.Id == surveyRowDetail.Id);

            result.Title      = surveyRowDetail.Title;
            result.ModifyDate = DateTime.Now;
        }
示例#5
0
        public async Task UpdateSurveyRow(SurveyRow surveyRow)
        {
            SurveyRow _surveyRow =
                await KoohTajrobeDbContext.Set <SurveyRow>()
                .FirstOrDefaultAsync(x => x.Id == surveyRow.Id);

            if (_surveyRow == null)
            {
                throw new Exception();
            }

            _surveyRow.Title            = surveyRow.Title;
            _surveyRow.ModifyDateTime   = DateTime.Now;
            _surveyRow.surveyRowDetails = surveyRow.surveyRowDetails;
        }
示例#6
0
        public async Task Update(Model.survey.Survey survey)
        {
            var existSurvey = await KoohTajrobeDbContext.Set <Model.survey.Survey>()
                              .FirstOrDefaultAsync(x => x.Id == survey.Id);

            if (existSurvey == null)
            {
                throw new KeyNotFoundException();
            }

            existSurvey.Title         = survey.Title;
            existSurvey.StartDateTime = survey.StartDateTime;
            existSurvey.EndDateTime   = survey.EndDateTime;
            existSurvey.userRole      = survey.userRole;
        }
示例#7
0
 public async Task <SurveyRow> GetSurveyRow(SurveyRow surveyRow)
 {
     return(await KoohTajrobeDbContext.Set <SurveyRow>()
            .FirstOrDefaultAsync(x => x.Id == surveyRow.Id));
 }
示例#8
0
 public async Task InsertSurveyRows(List <SurveyRow> surveyRows)
 {
     await KoohTajrobeDbContext.Set <SurveyRow>().AddRangeAsync(surveyRows);
 }
示例#9
0
 public async Task InsertSurveyRow(SurveyRow surveyRow)
 {
     await KoohTajrobeDbContext.Set <SurveyRow>().AddAsync(surveyRow);
 }
示例#10
0
 public async Task <List <Model.survey.Survey> > GetAllByUserRoleId(UserRole userRole)
 {
     return(await KoohTajrobeDbContext.Set <Model.survey.Survey>()
            .Where(x => x.userRole.Id == userRole.Id)
            .ToListAsync());
 }
示例#11
0
 public async Task <List <Model.survey.Survey> > GetAll()
 {
     return(await KoohTajrobeDbContext.Set <Model.survey.Survey>().ToListAsync());
 }
示例#12
0
 public async Task Insert(Model.survey.Survey survey)
 {
     await KoohTajrobeDbContext.Set <Model.survey.Survey>().AddAsync(survey);
 }
示例#13
0
 public async Task <SurveyRowDetail> GetSurveyRowDetail(SurveyRowDetail surveyRowDetail)
 {
     return(await KoohTajrobeDbContext.Set <SurveyRowDetail>()
            .FirstOrDefaultAsync(x => x.Id == surveyRowDetail.Id));
 }
示例#14
0
 public async Task InsertSurveyRowDetail(SurveyRowDetail surveyRowDetail)
 {
     await KoohTajrobeDbContext.Set <SurveyRowDetail>().AddAsync(surveyRowDetail);
 }
示例#15
0
 public async Task <Model.survey.Survey> GetAllSurveyRowBySurveyId(Model.survey.Survey survey)
 {
     return(await KoohTajrobeDbContext.Set <Model.survey.Survey>().Include(x => x.surveyRows)
            .FirstOrDefaultAsync(x => x.Id == survey.Id));
 }