| 1234567891011121314151617181920212223242526272829 |
- 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()
- {
- 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 });
- }
- }
- }
|