public LiveChatRoom Find(System.Linq.Expressions.Expression <Func <LiveChatRoom, bool> > where) { LiveChatRoom rc = null; try { if (where != null) { rc = db.Queryable <LiveChatRoom>().First(where); } } catch (Exception ex) { log.Error("Find", ex); } return(rc); }
public long Add(LiveChatRoom model) { long rc = 0; try { if (model != null) { rc = db.Insertable(model).ExecuteReturnBigIdentity(); } } catch (Exception ex) { log.Error("Add", ex); } return(rc); }
//创建聊天的房间 public void JoinRoom(string liveId) { try { //查询出该房间是否开放 LiveChatRoomBLL roomBiz = new LiveChatRoomBLL(); LiveChatRoom room = roomBiz.Find(it => it.LiveID == Convert.ToInt32(liveId) && it.Status == 1); //如果房间为空,则创建该聊天房间 if (room == null) { room = new LiveChatRoom { LiveID = Convert.ToInt32(liveId), Status = 1 }; room.ID = roomBiz.Add(room); } if (room != null && room.ID > 0) { //将ConnectionID发送给自己 Clients.Client(Context.ConnectionId).intoRoom(Context.ConnectionId); } } catch (Exception ex) { } }
public long Add(LiveChatRoom model) { return(dal.Add(model)); }