public ActionResult Edit(int DailyInfoId, Project project, int? WorkCategoryId, string WorkContent, DateTime CreateDate, int WorkingHours, int? EmployeeList, byte[] RowVersion)
        {
            DailyInfo dailyinfo = db.Dailies.Where(d => d.DailyInfoId == DailyInfoId && d.RowVersion == RowVersion).FirstOrDefault();

            if (dailyinfo == null)
            {
                return View("Error");
            };

            dailyinfo.Project = db.Projects.Find(project.ProjectId);
            dailyinfo.WorkCategoryId = WorkCategoryId;
            dailyinfo.WorkContent = WorkContent;
            dailyinfo.CreateDate = CreateDate;
            dailyinfo.WorkingHours = WorkingHours;

            if (EmployeeList != null)
            {
                dailyinfo.EmployeeId = Convert.ToInt32(EmployeeList);
            }

            if (ModelState.IsValid)
            {
                db.Entry(dailyinfo).State = EntityState.Modified;
                db.SaveChanges();

                return RedirectToAction("Index");
            }
            return View(dailyinfo);
        }
        public ActionResult DetailsEditedPredictions(Project project)
        {
            project.Predictions.ForEach(x => x.WorkCategory = db.Categories.Find(x.WorkCategory.WorkCategoryId));

            if (ModelState.IsValid)
            {
                foreach (var i in project.Predictions)
                {
                    if (i.PredictionId == 0)
                    {
                        db.Categories.Attach(i.WorkCategory);
                        db.Entry(i).State = EntityState.Added;
                    }
                    else
                    {
                        db.Categories.Attach(i.WorkCategory);
                        db.Entry(i).State = EntityState.Modified;
                    }
                }
                db.Entry(project).State = EntityState.Modified;
                db.SaveChanges();
            }
            return RedirectToAction("Details", new { id = project.ProjectId });
        }
        public ActionResult Create(Project project, int? WorkCategoryId, string WorkContent, DateTime CreateDate, int WorkingHours, int? EmployeeList )
        {
            DailyInfo dailyinfo = new DailyInfo();
            dailyinfo.Project = db.Projects.Find(project.ProjectId);
            dailyinfo.WorkCategoryId = WorkCategoryId;
            dailyinfo.WorkContent = WorkContent;
            dailyinfo.CreateDate = CreateDate;
            dailyinfo.WorkingHours = WorkingHours;
            dailyinfo.Employee = db.Employees.Where(e => (EmployeeList == null && e.Account == User.Identity.Name) || (EmployeeList != null && e.EmployeeId == EmployeeList)).FirstOrDefault();

            if (ModelState.IsValid)
            {
                db.Dailies.Add(dailyinfo);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(dailyinfo);
        }