예제 #1
0
        public async Task <ActionResult <int> > Create([Required] TaskDto task)
        {
            var myTask = new Common.Models.Task {
                Description = task.Description, Title = task.Title
            };
            await _taskDatabase.Add(myTask);

            return(myTask.Id);
        }
예제 #2
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await _taskContext.Add(Task);

            return(Redirect("/Projects/Details?id=" + Task.ProjectId));
        }