public ActionResult ManageActivities(ManageActivities model)
        {
            try{
                var ActivityName        = model.ActivityName.Trim();
                var ActivityDescription = model.ActivityDescription.Trim();

                var temp = db.Activities.Where(r => r.Activity1 == ActivityName && r.IsActive == true).Select(f => f.Activity1);

                foreach (var check in temp)
                {
                    if (check == ActivityName)
                    {
                        return(Json("Warning", JsonRequestBehavior.AllowGet));
                    }
                }

                {
                    var Assignobj = db.Activities.CreateObject();
                    Assignobj.Activity1           = ActivityName;
                    Assignobj.ActivityDescription = ActivityDescription;
                    db.Activities.AddObject(Assignobj);
                    db.SaveChanges();
                }
            }
            catch (Exception Ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
            }
            return(Json("Success", JsonRequestBehavior.AllowGet));
        }
        public ActionResult EditActivities(ManageActivities Model)
        {
            try{
                DSRCManagementSystemEntities1 db = new DSRCManagementSystemEntities1();
                int    ActivityId          = Model.ActivityId;
                string ActivityName        = Model.ActivityName.Trim();
                string ActivityDescription = "";
                if (Model.ActivityDescription != null)
                {
                    ActivityDescription = Model.ActivityDescription.Trim();
                }


                var data = db.Activities.Where(o => o.ActivityID != ActivityId && o.IsActive == true).Select(o => o.Activity1);

                foreach (var check in data)
                {
                    if (check == ActivityName)
                    {
                        return(Json("Warning", JsonRequestBehavior.AllowGet));
                    }
                }
                var datas = db.Activities.Where(o => o.ActivityID == ActivityId).Select(o => o).FirstOrDefault();
                {
                    datas.Activity1           = ActivityName;
                    datas.ActivityDescription = ActivityDescription;
                    db.SaveChanges();
                }
            }
            catch (Exception Ex)
            {
                string actionName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ExceptionHandlingController.ExceptionDetails(Ex, actionName, controllerName);
            }
            return(Json("Success1", JsonRequestBehavior.AllowGet));
        }