public ActionResult Evaluate(int id, EvaluateViewModel model, User user, string btnSend, string btnAccept, string btnDecline, string btnBack) { Suggestion suggestion = _suggestionRepository.FindBy(id); var student = suggestion.Student; if (ModelState.IsValid) { try { var promotor = (Promotor)user; if (btnSend != null) { promotor.GiveFeedback(model.Suggestion.Feedback, student, suggestion, ""); TempData["Success"] = "Uw feedback is verzonden"; } if (btnAccept != null) { promotor.GiveFeedback(model.Suggestion.Feedback, student, suggestion, btnAccept); //notifieer stakeholder TempData["Success"] = "Het voorstel is geaccepteerd"; } if (btnDecline != null) { promotor.SuggestionDoesNotComply(student, suggestion); //notifieer stakeholder TempData["Success"] = "Het voorstel is afgekeurd"; } _suggestionRepository.SaveChanges(); if (btnBack != null) { return RedirectToAction("Index", "Suggestion"); } } catch (ApplicationException e) { ModelState.AddModelError("", e.Message); // shows in summary } } TempData["Error"] = "Uw verzoek is niet gelukt"; return View(); }
//public ActionResult Suggestions(int id) //{ // IEnumerable<Suggestion> suggestions = _suggestionRepository.FindByUser(id).ToList(); // return View(); //} public ActionResult Evaluate(int id) { Suggestion suggestion = _suggestionRepository.FindBy(id); EvaluateViewModel suggestionViewModel = new EvaluateViewModel() { Suggestion = new SuggestionViewModel() { Id = suggestion.Id, Context = suggestion.Context, Goal = suggestion.Goal, Keywords = suggestion.Keywords, Motivation = suggestion.Motivation, References = suggestion.References, Subject = suggestion.Subject, ResearchQuestion = suggestion.ResearchQuestion, Title = suggestion.Title } }; return View(suggestionViewModel); }