Home view
[wsti_pai.git] / Projects / Controllers / HomeController.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.Mvc;
6 using Projects.Models;
7
8 namespace Projects.Controllers
9 {
10     public class HomeController : Controller
11     {
12         private ProjectsDBEntities db = new ProjectsDBEntities();
13
14         public ActionResult Index()
15         {
16             Project recentProject = (from d in db.Projects
17                                      orderby d.updated_at descending
18                                      select d)
19                 .FirstOrDefault();
20             ProjectTask recentTask = (from d in db.ProjectTasks
21                                      orderby d.updated_at descending
22                                      select d)
23                 .FirstOrDefault();
24
25             ViewBag.recentProject = recentProject;
26             ViewBag.recentTask = recentTask;
27             
28             return View();
29         }
30
31         public ActionResult Contact()
32         {
33             ViewBag.Message = "Your contact page.";
34
35             return View();
36         }
37     }
38 }