public ActionResult VolenteerForm(int sessionId, int?volId, int?corId) { evaluation_volunteer ecpp = new EvaluationVolunteerRepository().GetEvaluationForm(sessionId); if (ecpp == null) { ecpp = new evaluation_volunteer(); ecpp.SessionId = sessionId; if (volId != null) { var schoolName = new SessionRepository().Get(sessionId).school.SchoolName; ecpp.VolunteerId = volId.Value; var vol = new VolunteerRepository().Get(volId.Value); ecpp.F1 = schoolName; ecpp.F2 = vol.Region; ecpp.F3 = vol.City; ecpp.F5 = vol.VolunteerName; } if (corId != null) { ecpp.CoordinatorId = corId.Value; } } return(View(ecpp)); }
public ActionResult VolenteerForm(evaluation_volunteer ecpp) { var repo = new EvaluationVolunteerRepository(); ecpp.RowId = Guid.NewGuid(); ecpp.CreatedAt = DateTime.Now; repo.Post(ecpp); var session = new SessionRepository().Get(ecpp.SessionId); var userId = session.CreatedBy; var adminEmail = new AccountRepository().Get(userId).Email; var corName = new CoordinatorRepository().Get(ecpp.CoordinatorId).CoordinatorName; var bogusController = Util.CreateController <EmailTemplateController>(); EmailTemplateModel model = new EmailTemplateModel { Title = "Evaluation Form Completion", VolunteerName = session.volunteer_profile.VolunteerName, CoordinatorName = corName, SessionTitle = session.ProgramName }; string body = Util.RenderViewToString(bogusController.ControllerContext, "VolunteerFeedBack", model); EmailSender.SendSupportEmail(body, adminEmail); return(RedirectToAction("Index", "Session")); }