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

            var viewModel = new ActivityViewModel(db.Subjects.OrderBy(s => s.Name))
                {
                    Activity = activity
                };
            return View(viewModel);
        }
        public JsonResult Add(Activity activity)
        {
            try
            {
                activity.CreationDate = DateTime.UtcNow;
                db.Activities.Add(activity);
                db.SaveChanges();
                var result = new
                    {
                        result = true,
                        activity = activity
                    };

                return Json(result);
            }
            catch (Exception)
            {
                var result = new
                {
                    result = false
                };
                return Json(result);
            }
        }
 public ActionResult Edit(Activity activity)
 {
     if (ModelState.IsValid)
     {
         db.Entry(activity).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     var viewModel = new ActivityViewModel(db.Subjects.OrderBy(s => s.Name))
     {
         Activity = activity
     };
     return View(viewModel);
 }