HomeController.cs 905 B

123456789101112131415161718192021222324252627282930313233343536
  1. using CD67.FicheCollege.Entity;
  2. using CD67.FicheCollege.Factory;
  3. using System;
  4. using System.Linq;
  5. using System.Net;
  6. using System.Web.Mvc;
  7. namespace CD67.FicheCollege.MVC.Controllers
  8. {
  9. public class HomeController : Controller
  10. {
  11. private Entities db = new Entities();
  12. // GET: Home
  13. public ActionResult Index()
  14. {
  15. int annee_id;
  16. if (Request.Cookies["last_selected_year"] != null)
  17. {
  18. annee_id = Int32.Parse(Request.Cookies["last_selected_year"].Value);
  19. } else
  20. {
  21. AnneeFactory fact = new AnneeFactory(db);
  22. annee_id = fact.get_current_year_id();
  23. }
  24. return RedirectToAction("Details", "Annees", new { id = annee_id });
  25. }
  26. public ActionResult Unauthorized()
  27. {
  28. return View();
  29. }
  30. }
  31. }