public string SaveClassRoom(string jsonString, string action) { try { ClassRoomInfoEntity entity = JsonConvert.DeserializeObject <ClassRoomInfoEntity>(jsonString); ClassRoomInfoManager manager = new ClassRoomInfoManager(); if (action == "add") { manager.Insert(entity); } else { ClassRoomInfoEntity oldEntity = manager.GetClassRoomInfoByCode(entity.Code); oldEntity.Name = entity.Name; oldEntity.Address = entity.Address; oldEntity.Type = entity.Type; oldEntity.SeatNum = entity.SeatNum; oldEntity.UpdateBy = SessionHelper.CurrentUser.Code; manager.Update(oldEntity); } return("success"); } catch (Exception e) { return(e.ToString()); } }
public string GetClassRoomInfoByCode(string code) { ClassRoomInfoManager manager = new ClassRoomInfoManager(); return(new JavaScriptSerializer().Serialize(manager.GetClassRoomInfoByCode(code))); }