Esempio n. 1
0
        public async Task<ActionResult> GetAll([FromServices] IProjetoService service)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState); //Solicitacao Indevida 400

            try
            {
                return Ok(await service.GetAll());
            }
            catch (ArgumentException ex) //200 Sucesso
            {

                return StatusCode((int)HttpStatusCode.InternalServerError, ex.Message);
            }
        }
Esempio n. 2
0
 public IEnumerable <ProjetoViewModel> GetAll()
 {
     return(Mapper.Map <IEnumerable <Projeto>, IEnumerable <ProjetoViewModel> >(_projetoService.GetAll()));
 }