public ActionResult Weekly(int id, DateTime?week, FormCollection formCollection) { //int UserId = 1; //match date and get data from database of week TaskBusinessLayer taskBusinessLayer = new TaskBusinessLayer(); // Need to check isLoggedIn against UserId && active session in next phase List <Task> tasks = taskBusinessLayer.Tasks.Where(emp => emp.UUserId == id).ToList(); DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo; //DateTime date1 = new DateTime(2011, 1, 1); Calendar calendar = dfi.Calendar; //Console.WriteLine(calendar.ToString().Substring(calendar.ToString().LastIndexOf(".") + 1)); string weekof = calendar.ToString().Substring(calendar.ToString().LastIndexOf(".") + 1); // create weekly object storing hours of any Sunday to Saturday // inside of weekly object sun-sat float hours DateTime currentOfWeek = DateTime.Today.AddDays(-1 * (int)(DateTime.Today.DayOfWeek)); // create next week and previous week functionality DateTime nextOfWeek = currentOfWeek.AddDays(7); // previous week defintion DateTime previousOfWeek = currentOfWeek.Subtract(TimeSpan.FromDays(7)); // next week definition return(View()); }
// GET: Task public ActionResult Index() { // prepare for data connection // get data and use search function to get data // add data and add it to the List<Task> task // send task to view to be displayed` TaskBusinessLayer taskBusinessLayer = new TaskBusinessLayer(); IEnumerable <Task> tasks = taskBusinessLayer.Tasks.ToList(); return(View(tasks)); }