private static void MapValuesPollPortuguese(StudentPollPortuguese student, PortuguesePoll studentPollPortuguese) { studentPollPortuguese.writing1B = student.t1e; studentPollPortuguese.reading1B = student.t1l; studentPollPortuguese.writing2B = student.t2e; studentPollPortuguese.reading2B = student.t2l; studentPollPortuguese.writing3B = student.t3e; studentPollPortuguese.reading3B = student.t3l; studentPollPortuguese.writing4B = student.t4e; studentPollPortuguese.reading4B = student.t4l; }
private string ConverterProficienciaAluno(string proficiency, string term, PortuguesePoll aluno) { switch (term) { case "1° Bimestre": { if (proficiency == "Escrita") { return(MontarTextoProficiencia(aluno.writing1B)); } else { return(MontarTextoProficiencia(aluno.reading1B)); } } case "2° Bimestre": { if (proficiency == "Escrita") { return(MontarTextoProficiencia(aluno.writing2B)); } else { return(MontarTextoProficiencia(aluno.reading2B)); } } case "3° Bimestre": { if (proficiency == "Escrita") { return(MontarTextoProficiencia(aluno.writing3B)); } else { return(MontarTextoProficiencia(aluno.reading3B)); } } default: if (proficiency == "Escrita") { return(MontarTextoProficiencia(aluno.writing4B)); } else { return(MontarTextoProficiencia(aluno.reading4B)); } } }
public async void InsertPollPortuguese(List <StudentPollPortuguese> ListStudentsModel) { using (Contexts.SMEManagementContext db = new Contexts.SMEManagementContext()) { var listStudentsPoll = new List <PortuguesePoll>(); foreach (var student in ListStudentsModel) { var studentPollPortuguese = db.PortuguesePolls.Where(x => x.classroomCodeEol == student.classroomCodeEol && x.studentCodeEol == student.studentCodeEol).FirstOrDefault(); if (studentPollPortuguese == null) { studentPollPortuguese = new PortuguesePoll(); studentPollPortuguese.schoolYear = student.schoolYear; studentPollPortuguese.dreCodeEol = student.dreCodeEol; studentPollPortuguese.schoolCodeEol = student.schoolCodeEol; studentPollPortuguese.yearClassroom = student.yearClassroom; studentPollPortuguese.classroomCodeEol = student.classroomCodeEol; studentPollPortuguese.studentNameEol = student.name; studentPollPortuguese.studentCodeEol = student.studentCodeEol; MapValuesPollPortuguese(student, studentPollPortuguese); await db.PortuguesePolls.AddAsync(studentPollPortuguese); } else { MapValuesPollPortuguese(student, studentPollPortuguese); db.PortuguesePolls.Update(studentPollPortuguese); } } await db.SaveChangesAsync(); } }