public IActionResult AddBottleFeeding(AddBottleFeedingViewModel addBottleFeedingViewModel, int id) { if (ModelState.IsValid) { //var StudentID = addMealViewModel.StudentID; Student student = context.Students.Single(s => s.ID == id); BottleFeeding newBottleFeeding = new BottleFeeding { StudentID = student.ID, Date = addBottleFeedingViewModel.Date, Ounce = addBottleFeedingViewModel.Ounce }; context.BottleFeedings.Add(newBottleFeeding); context.SaveChanges(); return(Redirect(string.Format("/Form/InfantForm/{0}", student.ID))); } return(View(addBottleFeedingViewModel)); }
public IActionResult AddBottleFeeding() { AddBottleFeedingViewModel addBottleFeedingViewModel = new AddBottleFeedingViewModel(); return(View(addBottleFeedingViewModel)); }