public ActionResult Create([FromServices] IProjetoService collection) { try { var resultado = collection.Get().Result; return(RedirectToAction(nameof(Index))); } catch (Exception e) { return(View()); } }
public async Task<ActionResult> Get(int id) { if (!ModelState.IsValid) { return BadRequest(ModelState); } try { return Ok(await _servicoprojetos.Get(id)); } catch (ArgumentException e) { return StatusCode((int)HttpStatusCode.InternalServerError, e.Message); } }