Beispiel #1
0
        public JsonResult Approval(int id)
        {
            var dbnew = newsServices.GetNew(id);

            if (!dbnew.IsApproved)
            {
                dbnew.Appvovedby   = CurrenUser.Id;
                dbnew.DateApproved = DateTime.Now;
                dbnew.IsApproved   = true;
                newsServices.Commited();
                return
                    (Json(
                         new
                {
                    IsApproved = true,
                    messageErro = "Approved successfully",
                    ApproveMess = string.Format("Approved by:{0} at {1}", CurrenUser.FullName, dbnew.DateApproved.Value.ToString("dd/MM/yyyy"))
                },
                         JsonRequestBehavior.AllowGet));
            }
            else
            {
                dbnew.Appvovedby   = (long?)null;
                dbnew.DateApproved = null;
                dbnew.IsApproved   = false;
                newsServices.Commited();
                return(Json(new { IsApproved = false, messageErro = "DisApproved successfully" }, JsonRequestBehavior.AllowGet));
            }
        }