コード例 #1
0
        public async Task <IActionResult> Delete(int?id)//quer dizer que o id é opcional
        {
            if (id == null)
            {
                return(RedirectToAction(nameof(Error), new { message = "Id não foi fornecido!" }));
            }

            var obj = await _vendedoresService.BuscarPorIDAsync(id.Value);

            if (obj == null)
            {
                return(RedirectToAction(nameof(Error), new { message = "Id não encontrado!" }));
            }
            return(View(obj));
        }