public async Task <IActionResult> OnPost()
        {
            var retorno = await _clienteServices.Delete(Id);

            if (!retorno.IsValid())
            {
                ViewData.Add("Errors", retorno.ErrorMessages.ToErrorMessage());
                return(Page());
            }

            return(RedirectToPage("/Index"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Delete(Guid id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try {
                return(Ok(await _service.Delete(id)));
            } catch (ArgumentException e) {
                return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> DeleteCliente(int id)
        {
            var ClienteById = await _IClienteServices.Get(id);

            if (ClienteById == null)
            {
                return(BadRequest("Cliente no existe"));
            }

            _IClienteServices.Delete(ClienteById);

            return(Ok());
        }