Example #1
0
        public ActionResult Create(Activity activity)
        {
            if (ModelState.IsValid)
            {
                db.Activities.Add(activity);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.StatusId = new SelectList(db.Statuses, "Id", "Name", activity.StatusId);
            ViewBag.UserId = new SelectList(db.Users, "Id", "UserName", activity.UserId);
            ViewBag.WorkItemId = new SelectList(db.WorkItems, "Id", "Id", activity.WorkItemId);
            return View(activity);
        }
Example #2
0
 public ActionResult Edit(Activity activity)
 {
     if (ModelState.IsValid)
     {
         db.Entry(activity).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.StatusId = new SelectList(db.Statuses, "Id", "Name", activity.StatusId);
     ViewBag.UserId = new SelectList(db.Users, "Id", "UserName", activity.UserId);
     ViewBag.WorkItemId = new SelectList(db.WorkItems, "Id", "Id", activity.WorkItemId);
     return View(activity);
 }