Пример #1
0
 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);
 }
Пример #2
0
        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);
        }