public IActionResult TableUserCount(int tableId) { try { int count = _playTableService.TableUserCount(tableId); return(Ok(count)); } catch (AppException ex) { return(BadRequest(new { message = ex.Message })); } }
public static IList <PlayTableCountModel> GetTablesWithUserCount(IPlayTableService playTableService, IMapper mapper) { var tables = playTableService.GetAllTables(); var model = mapper.Map <IList <PlayTableCountModel> >(tables); foreach (var table in model) { table.UserCount = playTableService.TableUserCount(table.Id); } return(model); }