public DescriptivePaperDTO getDescriptivePaper(string code) { var paper = DescriptivePaperRepo.GetByPaperCode(code); var paperdto = Mapper.Map <DescriptivePaper, DescriptivePaperDTO>(paper); paperdto.PaperPdfUrl = paperdto.PaperPdfUrl.Replace(Fire.Ampersand, "&"); return(paperdto); }
public DescriptiveAnswerSheetDTO GetDescriptiveAnswerSheetForExam(string papercode) { var paper = Mapper.Map <DescriptivePaper, DescriptivePaperDTO>(DescriptivePaperRepo.GetByPaperCode(papercode)); paper.PaperPdfUrl = paper.PaperPdfUrl.Replace(Fire.Ampersand, "&"); var ansSheet = new DescriptiveAnswerSheetDTO() { Paper = paper }; return(ansSheet); }
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); }
public async Task deletePaper(string papercode) { switch (CodeGenerator.GetPaperType(papercode)) { case EPaperType.MCQ: McqPaperRepo.Delete(papercode); break; case EPaperType.Descriptive: await Fire.DeleteEverything(papercode, DescriptiveAnswerSheetRepo.GetAllResponseByCode(papercode).Select(paper => paper.StudentEmailId).ToList()); DescriptivePaperRepo.Delete(papercode); break; } }
public (DescriptivePaperDTO, List <DescriptiveAnswerSheetDTO>) GetDescriptiveAnswerSheetsBycode(string papercode) { var answersheets = DescriptiveAnswerSheetRepo.GetAllResponseByCode(papercode).ToList(); var paper = DescriptivePaperRepo.GetByPaperCode(papercode); var ans = ( paper : Mapper.Map <DescriptivePaper, DescriptivePaperDTO>(paper), answersheets : Mapper.Map <IEnumerable <DescriptiveAnswerSheet>, List <DescriptiveAnswerSheetDTO> >(answersheets) ); for (int i = 0; i < ans.Item2.Count; i++) { ans.answersheets[i].AnswerLink = ans.answersheets[i].AnswerLink.Replace("__AMP__", "&"); } return(ans); }
public async Task <string> CreateDescriptivePaper(DescriptivePaperDTO DesPaper) { string code = CodeGenerator.GetSharableCode(EPaperType.Descriptive); DesPaper.PaperCode = code; string linkwith = await Fire.Upload(DesPaper.paper.OpenReadStream(), null, code); DesPaper.PaperPdfUrl = linkwith.Replace("&", Fire.Ampersand); DescriptivePaper paper = Mapper.Map <DescriptivePaperDTO, DescriptivePaper>(DesPaper); DescriptivePaperRepo.Create(paper); EmailService.SendMailForPaper(code, linkwith, paper.PaperTitle, paper.CreatedDate.ToString(), paper.DeadLine.ToString(), paper.TeacherEmailId); //sends mail regarding paper update return(code); }
public IEnumerable <PaperDTO> getMCQPapersByEmailId(string emailId) { var ans = Mapper.Map <IEnumerable <MCQPaper>, List <PaperDTO> >(McqPaperRepo.GetByTeacherEmail(emailId)); var ansfinal = ans.Concat(Mapper.Map <IEnumerable <DescriptivePaper>, List <PaperDTO> >(DescriptivePaperRepo.GetByTeacherEmail(emailId))); return(ansfinal); }