public IActionResult Editar(int Id)
        {
            TempData["Message"] = null;
            var Categoria = _categoriaService.Get(Id);

            return(View(Categoria));
        }
        public IActionResult Get()
        {
            try
            {
                var categoriaResponse = _categoriaService.Get();

                return(Ok(categoriaResponse));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, new
                {
                    StatusCode = (int)HttpStatusCode.InternalServerError,
                    ErrorMessage = ex.Message,
                    stackTrace = ex.StackTrace
                }));
            }
        }
示例#3
0
 public async Task <ActionResult> Get()
 {
     try
     {
         return(Ok(await _categoriaService.Get()));
     }
     catch (Exception ex)
     {
         return(Error(ex));
     }
 }
        // GET: User/NovoOuEditar
        public async Task <ActionResult> NovoOuEditar(int id = 0)
        {
            if (id == 0)
            {
                return(View(new CategoriaDTOCreate()));
            }
            else
            {
                var user = await _serService.Get(id);

                var u = _mapper.Map <CategoriaDTOCreate>(user);

                return(View(u));
            }
        }
示例#5
0
 public async Task <ActionResult> Get(int id)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState)); //400 bad request - solicitaçao invalidos
     }
     try
     {
         return(Ok(await _service.Get(id)));
     }
     catch (ArgumentException e)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
     }
 }
示例#6
0
 public IActionResult Get(int id)
 {
     return(Ok(_ICategoriaService.Get(id)));
 }
示例#7
0
 public IActionResult Get()
 {
     return(Ok(categoriaService.Get()));
 }
示例#8
0
 public IActionResult Get(int id)
 {
     return(Json(
                _categoriaService.Get(id)
                ));
 }
示例#9
0
 public Categoria Get(int id)
 {
     return(_categoriaService.Get(id));
 }
示例#10
0
 // GET: api/Categorias
 public ICollection <CategoriaVO> Get()
 {
     return(sut.Get());
 }