Пример #1
0
        public AppConfigs.OperResult AddSchool(SchoolEntity mdl)
        {
            if (User.IsInRole(AppConfigs.AppRole.sys.ToString()) || User.IsInRole(AppConfigs.AppRole.schoolmaster.ToString()))
            {
                var ss = new SchoolSv();
                var se = ss.GetSchool(MyUserId);
                if (se != null) //already has a school
                {
                    se.MakeDay        = DateTime.Now;
                    se.SchoolMasterId = MyUserId;
                    se.SchoolUrl      = mdl.SchoolUrl;
                    se.Memo           = mdl.Memo;
                    return(ss.UpdateSchool(se));
                }
                else
                {
                    mdl.SchoolId       = Guid.NewGuid().ToString("n");
                    mdl.Maker          = MyUserId;
                    mdl.MakeDay        = DateTime.Now;
                    mdl.SchoolMasterId = MyUserId;

                    return(ss.AddSchool(mdl));
                }
            }

            return(AppConfigs.OperResult.failDueToAuthen);
        }
Пример #2
0
        public ActionResult update(SchoolEntity mdl)
        {
            var i = schoolSv.UpdateSchool(mdl);

            return(Json(new { i }, JsonRequestBehavior.AllowGet));
        }