Example #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (Completed)
            {
                Objective.DateCompleted = DateTime.Now;
            }

            var success = await _context.UpdateObjectiveAsync(Objective);

            if (success)
            {
                return(RedirectToPage("./List", new { Objective.CourseID }));
            }
            else
            {
                return(Page());
            }
        }