示例#1
0
        public async Task <ActionResult <TaskDto> > Get([Required] int id)
        {
            var task = await _taskDatabase.FindOrDefault(id);

            if (task == null)
            {
                return(NotFound());
            }
            else
            {
                var taskDto = new TaskDto();
                taskDto.Title       = task.Title;
                taskDto.Description = task.Description;
                return(taskDto);
            }
        }
示例#2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            Task = await _context.FindOrDefault(id.Value);

            if (Task == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Task = await _taskContext.FindOrDefault(id.Value);

            if (Task == null)
            {
                return(NotFound());
            }
            ViewData["ProjectId"] = new SelectList(_projectDatabase.GetAll(), "Id", "Title");
            return(Page());
        }