public async Task <IActionResult> PostSleeping([FromBody] PostSleepingDTO postSleepingDTO, int babyId) { var result = await sleepingsService.CreateSleeping(postSleepingDTO, babyId); if (result == null) { return(NotFound()); } return(CreatedAtAction("GetSleeping", new { id = result.Id }, postSleepingDTO)); }
public async Task <IActionResult> OnPostAsync() { if (ModelState.IsValid) { var result = await sleepingsService.CreateSleeping(NewSleeping, BabyId); if (result != null) { return(RedirectToPage("/Babies/Babies")); } else { return(Page()); } } return(Page()); }