public async Task <IActionResult> Create([Bind("UserID,Username")] Users users) { if (ModelState.IsValid) { _context.Add(users); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(users)); }
public async Task <IActionResult> Create([Bind("BabyID,BabyName,BabyGender,BirthDate,UserID")] BabyInfo babyInfo) { if (ModelState.IsValid) { _context.Add(babyInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserID"] = new SelectList(_context.Users, "UserID", "UserID", babyInfo.UserID); return(View(babyInfo)); }
public async Task <IActionResult> Create([Bind("NumberofDiaperChanges,BabyID")] DiaperChange diaperChange) { if (ModelState.IsValid) { _context.Add(diaperChange); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BabyID"] = new SelectList(_context.BabyInfo, "BabyID", "BabyID", diaperChange.BabyID); return(View(diaperChange)); }
public async Task <IActionResult> Create([Bind("FeedingID,NumberOfFeedings,FeedingTime,BabyID")] Feeding feeding) { if (ModelState.IsValid) { _context.Add(feeding); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BabyID"] = new SelectList(_context.BabyInfo, "BabyID", "BabyID", feeding.BabyID); return(View(feeding)); }