Esempio n. 1
0
        public async Task <IActionResult> GetPlatform(int id)
        {
            try
            {
                if (id == 0)
                {
                    return(BadRequest($"Parameter cannot be zero."));
                }

                if (uint.TryParse(id.ToString(), out uint identifier))
                {
                    var platform = await _clanService.GetClanPlatformAsync(identifier);

                    if (platform == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(platform));
                }
                else
                {
                    return(BadRequest($"Parameter was in wrong data format."));
                }
            }
            catch (Exception)
            {
                return(BadRequest(new Exception($"Something went wrong while processing the request.")));
            }
        }