Exemplo n.º 1
0
        public IActionResult Delete([FromBody] TodoViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var todoViewModel = _todoAppService.Delete(model);

            return(Ok(todoViewModel));
        }
Exemplo n.º 2
0
        public Results.GenericResult Delete(int id)
        {
            var result = new Results.GenericResult();

            try
            {
                result.Success = appService.Delete(id);
                if (!result.Success)
                {
                    throw new Exception($"Todo {id} can't be deleted");
                }
            }
            catch (Exception ex)
            {
                result.Errors = new string[] { ex.Message };
            }

            return(result);
        }
Exemplo n.º 3
0
 public bool Delete(int id)
 {
     return(appService.Delete(id));
 }