public void Create(FormCollection collection) { var msg = new Msg(); try { // 初始化对象 Entity.T_Building building = new Entity.T_Building() { Building_nickname = collection["name"], Building_note = collection["note"], Building_vid = collection["vid"], Building_dorm_id = Convert.ToInt32(collection["pid"]), }; var buildings = new Buildings(); if (buildings.Add(building)) { msg.Message = "添加成功!"; } else { throw new Exception("发生未知错误,添加失败!"); } } catch (Exception ex) { msg.Code = -1; msg.Message = ex.Message; } Response.Write(msg.ToJson()); Response.End(); }
/// <summary> /// 添加宿舍楼信息 /// </summary> /// <param name="Building"></param> /// <returns></returns> public bool Add(Entity.T_Building Building) { return(BuildingDb.Insert(Building)); }
/// <summary> /// 更新宿舍楼信息 /// </summary> /// <param name="Building"></param> /// <returns></returns> public bool Update(Entity.T_Building Building) { return(BuildingDb.Update(Building)); }