Exemple #1
0
        public void Create(FormCollection collection)
        {
            var msg = new Msg();

            try
            {
                // 初始化对象
                Entity.T_Dorm dorm = new Entity.T_Dorm()
                {
                    Dorm_nickname = collection["name"],
                    Dorm_note     = collection["note"],
                    Dorm_type     = Convert.ToBoolean(Convert.ToInt32(collection["type"])),
                };
                var Dorm = new Dorms();
                if (Dorm.Add(dorm))
                {
                    msg.Message = "添加成功!";
                }
                else
                {
                    throw new Exception("发生未知错误,添加失败!");
                }
            }
            catch (Exception ex)
            {
                msg.Code    = -1;
                msg.Message = ex.Message;
            }
            Response.Write(msg.ToJson());
            Response.End();
        }
Exemple #2
0
 /// <summary>
 /// 添加园区信息
 /// </summary>
 /// <param name="dorm"></param>
 /// <returns></returns>
 public bool Add(Entity.T_Dorm dorm)
 {
     return(DormDb.Insert(dorm));
 }
Exemple #3
0
 /// <summary>
 /// 更新园区信息
 /// </summary>
 /// <param name="dorm"></param>
 /// <returns></returns>
 public bool Update(Entity.T_Dorm dorm)
 {
     return(DormDb.Update(dorm));
 }