public IActionResult AddPlayer(PlayerDtos request) { try { _service.AddPlayer(request); return(NoContent()); } catch (PlayerExistExc exc) { return(BadRequest(exc.Message)); } catch (TooOldExc exc) { return(BadRequest(exc.Message)); } }
/// <summary> /// 给指定玩家的手牌排序 /// </summary> /// <param name="uid"></param> /// <param name="asc"></param> public void Sort(int uid, bool asc = true) { PlayerDto play = PlayerDtos.Find(a => a.Uid == uid); if (play != null) { play.CardDtos.Sort((a, b) => { if (asc) { return(a.Weight.CompareTo(b.Weight)); } else { return(a.Weight.CompareTo(b.Weight) * -1); } }); } }
public async Task AddPlayer(PlayerDtos player) { throw new NotImplementedException(); }