Beispiel #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            var taskStateDTO    = taskStateService.GetTaskState(id);
            var taskStateResult = MapperForCRUD(taskStateDTO);

            taskStateService.Delete(taskStateResult.StateId);
            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> DeleteTaskState(int id, int taskid, int taskstateid)
        {
            if (taskstateid <= 0)
            {
                return(RedirectToAction(nameof(CreateOrEdit), new{ id = id, taskid = taskid }));
            }

            var taskState = await _taskStateService.GetByIdAsync(taskstateid);

            if (taskState == null)
            {
                return(RedirectToAction(nameof(CreateOrEdit), new{ id = id, taskid = taskid }));
            }

            await _taskStateService.Delete(taskState);

            return(RedirectToAction(nameof(CreateOrEdit), new{ id = id, taskid = taskid }));
        }