public JsonResult SaveImportantDeadline(ImportantDeadlineModel importantDeadline)
        {
            var sessionId = this.Session["SessionID"].ToString();
            IUserSessionRepository userSessionRepository = RepositoryClassFactory.GetInstance().GetUserSessionRepository();
            UserSession            userSession           = userSessionRepository.FindByID(sessionId);

            if (userSession == null)
            {
                return(Json(new { errorCode = (int)ErrorCode.Redirect, message = Resources.AdminResource.msg_sessionInvalid }, JsonRequestBehavior.AllowGet));
            }
            InsertResponse response = new InsertResponse();

            importantDeadline.Title = importantDeadline.Title.Length > 200 ? importantDeadline.Title.Substring(0, 100) + "..." : importantDeadline.Title;
            if (importantDeadline.ShortContent != null)
            {
                importantDeadline.ShortContent = importantDeadline.ShortContent.Length > 300 ? importantDeadline.ShortContent.Substring(0, 296) + "..." : importantDeadline.ShortContent;
            }
            importantDeadline.DeadlineID  = Guid.NewGuid().ToString();
            importantDeadline.ActionURL   = string.Format("{0}-{1}", UrlSlugger.ToUrlSlug(importantDeadline.Title), UrlSlugger.Get8Digits());
            importantDeadline.CreatedDate = DateTime.Now;
            importantDeadline.CreatedBy   = userSession != null ? userSession.UserID : string.Empty;
            response = _importantDeadline.CreateImportantDeadline(importantDeadline);

            return(Json(new { errorCode = response.ErrorCode, message = response.Message }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult SaveUpdateImportantDeadline(ImportantDeadlineModel importantDeadline)
        {
            var sessionId = this.Session["SessionID"].ToString();
            IUserSessionRepository userSessionRepository = RepositoryClassFactory.GetInstance().GetUserSessionRepository();
            UserSession            userSession           = userSessionRepository.FindByID(sessionId);

            if (userSession == null)
            {
                return(Json(new { errorCode = (int)ErrorCode.Redirect, message = Resources.AdminResource.msg_sessionInvalid }, JsonRequestBehavior.AllowGet));
            }
            //importantDeadline.ActionURL = string.Format("{0}-{1}", UrlSlugger.ToUrlSlug(importantDeadline.Title), UrlSlugger.Get8Digits());
            importantDeadline.UpdatedBy  = userSession.UserID;
            importantDeadline.UpdateDate = DateTime.Now;
            BaseResponse response = _importantDeadline.UpdateImportantDealine(importantDeadline);

            return(Json(new { errorCode = response.ErrorCode, message = response.Message }, JsonRequestBehavior.AllowGet));
        }