Exemplo n.º 1
0
        public async Task <IActionResult> Get(int fraternityId)
        {
            try
            {
                Campaign[] result = await _repo.GetAllCampaignAsync();

                if (result != null)
                {
                    IEnumerable resultFilteres = result.Where(f => f.FraternityId == fraternityId);
                    return(Ok(resultFilteres));
                }
            }
            catch (System.Exception ex)
            {
                StatusCode(StatusCodes.Status500InternalServerError, $"Erro: {ex.Message}");
            }
            return(BadRequest());
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Get()
        {
            try
            {
                Campaign[] result = await _repo.GetAllCampaignAsync();

                if (result != null)
                {
                    return(Ok(result));
                }
            }
            catch (System.Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Erro: {ex.Message}"));
            }

            return(BadRequest());
        }