Exemplo n.º 1
0
        public IActionResult Delete(int id)
        {
            var delete = _todolistService.Delete(id);

            if (delete > 0)
            {
                return(Ok(delete));
            }
            return(BadRequest("Delete Failed!"));
        }
        public IActionResult Delete(int id)
        {
            var data = _toDoListService.Delete(id);

            if (data > 0)
            {
                return(Ok(data));
            }
            return(BadRequest("Failed"));
        }
Exemplo n.º 3
0
        public async Task <ToDo> Delete(int id)
        {
            //var task = await _toDoListService.GetById(id);
            //if (task == null)
            //{
            //    return null;
            //}

            return(await _toDoListService.Delete(id));
        }
Exemplo n.º 4
0
        public ActionResult Delete(int id)
        {
            var result = _toDoListService.Delete(id);

            if (result.HasError)
            {
                SetErrorMessage(result.Message);
            }
            ClearCache(id);
            return(RedirectToAction("List"));
        }
Exemplo n.º 5
0
        protected void rptToDoList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Delete")
            {
                var toDoList = _toDoListService.Get(id);
                _toDoListService.Delete(toDoList);
            }
            LoadToDoList();
        }
Exemplo n.º 6
0
        public IActionResult DeleteList(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }
            var entity = _toDoListService.GetById((int)id);

            if (entity != null)
            {
                _toDoListService.Delete(entity);
            }
            return(RedirectToAction("Index"));
        }