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); }
public ActionResult update(SchoolEntity mdl) { var i = schoolSv.UpdateSchool(mdl); return(Json(new { i }, JsonRequestBehavior.AllowGet)); }