public ActionResult PerformanceEdit(int id, int? projectid)
 {
     Performance s = db.Performance.Find(id);
     if (s == null)
     {
         s = new Performance { ProjectId = (int)projectid };
     }
     ViewBag.Reload = false;
     ViewBag.Project = db.Departments.Find(s.ProjectId);
     return View(s);
 }
        public ActionResult PerformanceEdit(int id, int? projectid, FormCollection collection)
        {
            Performance s = db.Performance.Find(id);
            if (s == null)
            {
                s = new Performance { ProjectId = (int)projectid };
                db.Performance.Add(s);
            }

            TryUpdateModel(s, "", new string[] { }, new string[] { "" }, collection);

            if (ModelState.IsValid)
            {
                db.SaveChanges();
                ViewBag.Success = true;
            }
            ViewBag.Project = db.Departments.Find(s.ProjectId);
            return View(s);
        }