示例#1
0
 public ActionResult Create([FromServices] IProjetoService collection)
 {
     try
     {
         var resultado = collection.Get().Result;
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception e)
     {
         return(View());
     }
 }
示例#2
0
        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);
            }

        }