Пример #1
0
        public async Task <IActionResult> PostReminder([FromRoute] string userId, [FromBody] PostReminderDTO postReminderDTO)
        {
            var result = await remindersService.CreateReminder(postReminderDTO, userId);

            if (result == null)
            {
                return(NotFound());
            }

            return(CreatedAtAction("GetReminder", new { id = result.Id }, postReminderDTO));
        }
Пример #2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                var userId = userManager.GetUserId(User);

                var result = await remindersService.CreateReminder(NewReminder, userId);

                if (result != null)
                {
                    return(RedirectToPage("/Babies/Reminders"));
                }
                else
                {
                    return(Page());
                }
            }
            return(Page());
        }