コード例 #1
0
        public IActionResult Delete([FromBody] TodoViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var todoViewModel = _todoAppService.Delete(model);

            return(Ok(todoViewModel));
        }
コード例 #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);
        }
コード例 #3
0
 public bool Delete(int id)
 {
     return(appService.Delete(id));
 }