public JsonResult GetActivities() { ActivityServices service = new ActivityServices(); int loggedInUser =Convert.ToInt16(SessionManagement.GetValue("UserId")); if (loggedInUser > 0) { return Json(service.GetAllActivities(loggedInUser), JsonRequestBehavior.AllowGet); } else { return Json("", JsonRequestBehavior.AllowGet); } }
public JsonResult AddNewActivity(Activity objActivity) { ActivityServices service = new ActivityServices(); if (ModelState.IsValid) { int loggedInUser = Convert.ToInt16( SessionManagement.GetValue("UserId")); objActivity.UserId = loggedInUser; service.SaveActivity(objActivity); return Json(objActivity, JsonRequestBehavior.AllowGet); } return Json("", JsonRequestBehavior.AllowGet); }