Exemplo n.º 1
0
 public bool Insert(T_RoomType obj)
 {
     if (_dal.Insert(obj))
     {
         this.GetAll();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        // POST: api/RoomType
        public void Post([FromBody] T_RoomType room)
        {
            ServiceObject obj = new ServiceObject();

            try
            {
                if (!_bll.Insert(room))
                {
                    obj.State = ServiceState.error;
                    obj.Msg   = "未能插入数据";
                }
            }
            catch (Exception ex)
            {
                obj.State = ServiceState.error;
                obj.Msg   = ex.Message;
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public bool Insert(T_RoomType obj)
 {
     using (XPMSEntities db = new XPMSEntities())
     {
         var query = from a in db.T_RoomType
                     where a.Name.Equals(obj.Name)
                     select a;
         if (query.Count() > 0)
         {
             throw new Exception("该名称已存在");
         }
         var model = db.T_RoomType.Add(obj);
         if (model == null)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
 }
Exemplo n.º 4
0
 // PUT: api/RoomType/5
 public void Put(int id, [FromBody] T_RoomType value)
 {
 }