Ejemplo n.º 1
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Tournaments           = new Challonge.Net.Tournaments(this);
     BaseUri               = new System.Uri("https://api.challonge.com/");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
 public static async Task <Models.TournamentElement> PostTournamentAsync(this ITournaments operations, CreateTournament model, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.PostTournamentWithHttpMessagesAsync(model, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 public static async Task <Models.TournamentElement> GetTournamentAsync(this ITournaments operations, string id, bool includeParticipants = false, bool includeMatches = false, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetTournamentWithHttpMessagesAsync(id, includeParticipants, includeMatches, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 public TournamentController(CricketContext context,
                             UserManager <IdentityUser <int> > userManager, ITournaments tournaments,
                             IMapper mapper)
 {
     _context     = context;
     _userManager = userManager;
     _mapper      = mapper;
     _tournaments = tournaments;
 }
 public TournamentController(CricketContext context,
                             UserManager <ApplicationUser> userManager, ITournaments tournaments, IHostingEnvironment hosting,
                             IMapper mapper)
 {
     _context     = context;
     _userManager = userManager;
     _mapper      = mapper;
     _tournaments = tournaments;
     _hosting     = hosting;
 }
 public static async Task DeleteRegionAsync(this ITournaments operations, string id, CancellationToken cancellationToken = default(CancellationToken))
 {
     var _result = await operations.DeleteTournamentWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false);
 }
 public static void DeleteRegion(this ITournaments operations, string id)
 {
     operations.DeleteRegionAsync(id).GetAwaiter().GetResult();
 }
 public static Models.TournamentElement PostTournament(this ITournaments operations, CreateTournament model)
 {
     return(operations.PostTournamentAsync(model).GetAwaiter().GetResult());
 }
 public static Models.TournamentElement GetTournament(this ITournaments operations, string id, bool includeParticipants = false, bool includeMatches = false)
 {
     return(operations.GetTournamentAsync(id, includeParticipants, includeMatches).GetAwaiter().GetResult());
 }
 public static async Task <IList <Models.TournamentElement> > GetTournamentAllAsync(this ITournaments operations, string state = default(string), string type = default(string), DateTime createdAfter = default(DateTime), DateTime createdBefore = default(DateTime), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetTournamentAllWithHttpMessagesAsync(state, type, createdAfter, createdBefore, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 public static IList <Models.TournamentElement> GetTournamentAll(this ITournaments operations, string state = default(string), string type = default(string), DateTime createdAfter = default(DateTime), DateTime createdBefore = default(DateTime))
 {
     return(operations.GetTournamentAllAsync(state, type, createdAfter, createdBefore).GetAwaiter().GetResult());
 }