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); } }
public IEnumerable <ProjetoViewModel> GetAll() { return(Mapper.Map <IEnumerable <Projeto>, IEnumerable <ProjetoViewModel> >(_projetoService.GetAll())); }