public AnswerSheetDTO GetAnswerSheet(string paperCode, string studentEmailId) { switch (CodeGenerator.GetPaperType(paperCode)) { case EPaperType.MCQ: var ans = AnswerSheetRepo.GetByPaperCodeAndStudentEmail(paperCode, studentEmailId); if (ans == null) { return(null); } var ret = Mapper.Map <MCQAnswerSheet, MCQAnswerSheetDTO>(ans); if (ret != null) { ret.Paper = Mapper.Map <MCQPaper, MCQPaperDTO>(ans.MCQPaper); } return(ans == null ? null : ret); case EPaperType.Descriptive: var ans1 = DescriptiveAnswerSheetRepo.GetByPaperCodeAndStudentEmail(paperCode, studentEmailId); if (ans1 == null) { return(null); } var ret1 = Mapper.Map <DescriptiveAnswerSheet, DescriptiveAnswerSheetDTO>(ans1); if (ret1 != null) { ret1.Paper = Mapper.Map <DescriptivePaper, DescriptivePaperDTO>(ans1.DescriptivePaper); } return(ans1 == null ? null : ret1); } return(null); }
public async Task SetDescriptiveAnswerSheet(DescriptiveAnswerSheetDTO desanswersheetdto, string studentEmailId) { var answersheet = new DescriptiveAnswerSheet(); answersheet.StudentEmailId = studentEmailId; answersheet.SubmittedTime = DateTime.Now; answersheet.DescriptivePaperId = DescriptivePaperRepo.GetByPaperCode(desanswersheetdto.Paper.PaperCode).PaperId; string linkwith = await Fire.Upload(desanswersheetdto.AnswerSheet.OpenReadStream(), studentEmailId, desanswersheetdto.Paper.PaperCode); answersheet.AnswerLink = linkwith.Replace("&", Fire.Ampersand); DescriptiveAnswerSheetRepo.SetDescriptiveAnswerSheet(answersheet); }