public bool AddRoom(IRoomDTO dto) { try { using (MySqlConnection conn = new MySqlConnection(_connection)) { conn.Open(); using (MySqlCommand cmd = new MySqlCommand("INSERT INTO room (Name,Capacity, StakeUpLim,StakeLowLim,RoundTime) VALUES(@Name,@Capacity,@StakeUpLim,@StakeLowLim,@RoundTime)", conn)) { cmd.Parameters.AddWithValue("@Name", dto.Name); cmd.Parameters.AddWithValue("@Capacity", dto.Capacity); cmd.Parameters.AddWithValue("@StakeUpLim", dto.StakeUpLim); cmd.Parameters.AddWithValue("@StakeLowLim", dto.StakeLowLim); cmd.Parameters.AddWithValue("@RoundTime", dto.RoundTime); if (cmd.ExecuteNonQuery() > 0) { return(true); } return(false); } } } catch (MySqlException ex) { throw new Exception(ex.Message, ex); } }
public bool Update(IRoomDTO dto) { int index = rooms.FindIndex(i => i.Id == dto.Id); rooms[index] = dto; return(true); }
public bool Update(IRoomDTO dto) { try { using (MySqlConnection conn = new MySqlConnection(_connection)) { conn.Open(); using (MySqlCommand cmd = new MySqlCommand("Update room SET Name = @Name, Capacity=@Capacity, StakeUpLim=@StakeUpLim, StakeLowLim=@StakeLowLim, RoundTime=@RoundTime WHERE Id = @Id")) { cmd.Parameters.AddWithValue("@Name", dto.Name); cmd.Parameters.AddWithValue("@Capacity", dto.Capacity); cmd.Parameters.AddWithValue("@StakeUpLim", dto.StakeUpLim); cmd.Parameters.AddWithValue("@StakeLowLim", dto.StakeLowLim); cmd.Parameters.AddWithValue("@RoundTime", dto.RoundTime); cmd.Parameters.AddWithValue("@Id", dto.Id); if (cmd.ExecuteNonQuery() > 0) { return(true); } return(false); } } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private Room ExtractRoom(IRoomDTO dto) { return(new Room(dto.Id, _roomDAL, _roundDAL, _userDAL, _betDAL, _wheel) { Name = dto.Name, Capacity = dto.Capacity, StakeUpLim = dto.StakeUpLim, StakeLowLim = dto.StakeLowLim, RoundTime = dto.RoundTime }); }
private Room ExtractRoom(IRoomDTO dto) { return(new Room(dto.Name, null) { Id = dto.Id, Capacity = dto.Capacity, StakeUpLim = dto.StakeUpLim, StakeLowLim = dto.StakeLowLim, RoundTime = dto.RoundTime }); }
public bool AddRoom(Room room) { if (room != null) { IRoomDTO dto = room; if (_containerDAL.AddRoom(dto)) { Rooms.Add(room); return(true); } } return(false); }
public bool Save(IRoomDTO dto) { rooms.Add(dto); return(true); }
public bool AddRoom(IRoomDTO dto) { rooms.Add(dto); return(true); }