using System.Linq;
using System.Web;
using System.Web.Mvc;
+using Projects.Models;
namespace Projects.Controllers
{
public class HomeController : Controller
{
- public ActionResult Index()
- {
- return View();
- }
+ private ProjectsDBEntities db = new ProjectsDBEntities();
- public ActionResult About()
+ public ActionResult Index()
{
- ViewBag.Message = "Your application description page.";
+ Project recentProject = (from d in db.Projects
+ orderby d.updated_at descending
+ select d)
+ .FirstOrDefault();
+ ProjectTask recentTask = (from d in db.ProjectTasks
+ orderby d.updated_at descending
+ select d)
+ .FirstOrDefault();
+ ViewBag.recentProject = recentProject;
+ ViewBag.recentTask = recentTask;
+
return View();
}