public ActionResult Repondre(Claims claim, string texte, Response response) { int id = claim.IdClaims; Claims updateClaim = cs.GetById(id); updateClaim.State = 1; response.Content = texte; response.ResponseDate = DateTime.Now; response.idClaim = id; rs.Add(response); rs.Commit(); try { //MailMessage mail = new MailMessage("*****@*****.**","*****@*****.**") ; MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**"); mail.Subject = texte; mail.Body = "BONJOUR : Je vous propose mon projet intitulé " + "'" + texte + "'" + "qui sera composé de ressource(s) de votre entreprise dont les skills sont "; SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587); smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "$$$$$$$$$"); smtpClient.EnableSsl = true; smtpClient.Send(mail); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "IdResponse,ResponseDate,Content")] Response response) { if (ModelState.IsValid) { response.ResponseDate = DateTime.Now; Rs.Add(response); Rs.Commit(); return(RedirectToAction("Index")); } return(View(response)); }
public ActionResult Index1(Guid key, int QuestionnaireID, ResponseViewModel[] responses, ResponseGoal goal) { if (ModelState.IsValid) { Student student = _studentService.GetStudentByKey(key); if (student != null) { foreach (var item in responses) { _responseService.Add(new Response { Question_ID = item.Question_ID, Response_ID = item.Response_ID, Student_ID = student.ID }); } _responseGoalService.Add(new ResponseGoal { Student_ID = student.ID, First_Goal_ID = goal.First_Goal_ID, Why = goal.Why }); _unitOfWork.Commit(); Question next = _questionService.NextQuestionnaire(QuestionnaireID); if (next == null) { return(RedirectToAction("Finish", new { key = key })); } else { return(RedirectToAction("Index", new { ID = next.ID, key = key })); } } } ViewBag.Questionnaire = _questionService.GetQuestionnaire(QuestionnaireID); return(View()); }