Пример #1
0
        public JsonResult GetTestInfo(EPortal.Models.Test Testinfo)
        {
            //string orgid = Session["OrgId"].ToString();
            string   orgid        = User.OrgId;
            TestList TestinfoTest = new TestList();

            using (EPortalEntities entity = new EPortalEntities())
            {
                TestinfoTest = (from o in entity.Tests
                                where o.Id == Testinfo.Id &&
                                o.OrganizationID == orgid
                                select new TestList
                {
                    Id = o.Id,
                    TestCode = o.TestCode,
                    TestName = o.TestName,
                    PeriodFrom = o.PeriodFrom,
                    PeriodTo = o.PeriodTo,
                    Operation = "Edit",
                    HourTime = o.HourTime,
                    MinTime = o.MinTime,
                    IsPublish = o.IsPublish,
                    Islocked = o.Islocked
                }).FirstOrDefault();
            }
            return(Json(TestinfoTest, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public JsonResult PublishTest(TestList test)
        {
            //string orgid = Session["OrgId"].ToString();
            string orgid  = User.OrgId;
            int    result = 0;

            using (EPortalEntities entity = new EPortalEntities())
            {
                var testmodel = (from t in entity.Tests
                                 where t.OrganizationID == orgid &&
                                 t.Id == test.Id
                                 select t).FirstOrDefault();
                if (testmodel != null)
                {
                    testmodel.IsPublish           = true;
                    entity.Entry(testmodel).State = System.Data.Entity.EntityState.Modified;
                }

                result = entity.SaveChanges();
            }
            return(Json(result > 0 ? true : false, JsonRequestBehavior.AllowGet));
        }