public async Task<QuesMaster> AddQuesMasterAsync(QuesMaster quesMaster) { //var rstScUsr = scUsrRespository.Insert(scUsr); //scCompInfo. var rstQuesMaster = _quesMasterRepository.Insert(quesMaster); if (rstQuesMaster != null) { await SaveDbContextAsync(); } return rstQuesMaster; }
public async Task<ActionResult> Summary01(QuesMasterViewModel quesMasterViewModel) { ViewBag.LeftMenu = Global.Report; int questionSn = quesMasterViewModel.QuestionSn; if (quesMasterViewModel.QuestionSn > 0) { var quesMaster = await _quesMasterService.GetQuesMasterAsync(quesMasterViewModel.QuestionSn); quesMaster.QuesWriter.CompNm = quesMasterViewModel.QuesWriter.CompNm; quesMaster.QuesWriter.Name = quesMasterViewModel.QuesWriter.Name; quesMaster.QuesWriter.Position = quesMasterViewModel.QuesWriter.Position; quesMaster.QuesWriter.TelNo = quesMasterViewModel.QuesWriter.TelNo; quesMaster.QuesWriter.Email = quesMasterViewModel.QuesWriter.Email; quesMaster.QuesWriter.UpdDt = DateTime.Now; quesMaster.QuesWriter.UpdId = Session[Global.LoginID].ToString(); if (quesMasterViewModel.SubmitType == "T") { quesMaster.SaveStatus = 1; } else { quesMaster.SaveStatus = 2; } await _quesMasterService.SaveDbContextAsync(); } else { var quesMaster = new QuesMaster(); quesMaster.BasicYear = DateTime.Now.Year; quesMaster.RegistrationNo = Session[Global.CompRegistrationNo].ToString(); quesMaster.Status = "P"; if (quesMasterViewModel.SubmitType == "T") { quesMaster.SaveStatus = 1; } else { quesMaster.SaveStatus = 2; } var quesWriter = Mapper.Map<QuesWriter>(quesMasterViewModel.QuesWriter); quesWriter.RegDt = DateTime.Now; quesWriter.RegId = Session[Global.LoginID].ToString(); quesMaster.QuesWriter = quesWriter; var saveQuesMaster = await _quesMasterService.AddQuesMasterAsync(quesMaster); questionSn = saveQuesMaster.QuestionSn; } if (quesMasterViewModel.SubmitType == "T") { return RedirectToAction("Summary01", "Report", new { @questionSn = questionSn }); } else { return RedirectToAction("Summary02", "Report", new { @questionSn = questionSn }); } }