AnneesController.cs 819 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Web.Mvc;
  2. using System.Net;
  3. using CD67.FicheCollege.Factory;
  4. using CD67.FicheCollege.Entity;
  5. using CD67.FicheCollege.MVC.Models;
  6. namespace CD67.FicheCollege.MVC.Controllers
  7. {
  8. public class AnneesController : Controller
  9. {
  10. private Entities db = new Entities();
  11. // GET: Home
  12. public ActionResult Details(int? id)
  13. {
  14. if (id == null)
  15. {
  16. return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
  17. }
  18. AnneeFactory anneeFactory = new AnneeFactory(db);
  19. Entity.Annee annee = anneeFactory.getById(id);
  20. if (annee == null)
  21. {
  22. return HttpNotFound();
  23. }
  24. TopModel model = new TopModel(annee);
  25. return View(model);
  26. }
  27. }
  28. }