|
|
@@ -1,13 +1,29 @@
|
|
|
-using System.Web.Mvc;
|
|
|
+using CD67.FicheCollege.Entity;
|
|
|
+using System;
|
|
|
+using System.Linq;
|
|
|
+using System.Web.Mvc;
|
|
|
|
|
|
namespace CD67.FicheCollege.MVC.Controllers
|
|
|
{
|
|
|
public class HomeController : Controller
|
|
|
{
|
|
|
+ private Entities db = new Entities();
|
|
|
+
|
|
|
// GET: Home
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
- return View();
|
|
|
+ string annee_lib;
|
|
|
+
|
|
|
+ if (DateTime.Now.Month <= 6) {
|
|
|
+ annee_lib = String.Format("{0}-{1}", DateTime.Now.Year - 1, DateTime.Now.Year);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ annee_lib = String.Format("{0}-{1}", DateTime.Now.Year, DateTime.Now.Year + 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ int annee_id = db.Annees.Where(a => a.Libelle == annee_lib).First().Id;
|
|
|
+
|
|
|
+ return RedirectToActionPermanent("Details", "Annees", new { id = annee_id });
|
|
|
}
|
|
|
}
|
|
|
}
|