public ActionResult DeleteConfirmed(int id) { using (Nutrition db = new Nutrition()) { G3_Nutrition_Nutrition table = db.G3_Nutrition_Nutrition.Find(id); db.G3_Nutrition_Nutrition.Remove(table); db.SaveChanges(); return(RedirectToAction("View", "Nutrition", new { id = table.UserId })); } }
public ActionResult Edit(G3_Nutrition_Nutrition table) { using (Nutrition db = new Nutrition()) { if (ModelState.IsValid) { table.Date = DateTime.Now; db.Entry(table).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "Nutrition")); } } return(RedirectToAction("View", "Nutrition", new { id = table.UserId })); }
public ActionResult Create(SystemNutrition A) { G3_Nutrition_Nutrition B = new G3_Nutrition_Nutrition(); B.UserId = A.Nutrition.UserId; B.Title = A.Nutrition.Title; B.Content = A.Nutrition.Content; B.Doctor = User.Identity.Name; B.Date = DateTime.Now; using (Nutrition db = new Nutrition()) { db.G3_Nutrition_Nutrition.Add(B); db.SaveChanges(); } return(RedirectToAction("Index", "Nutrition")); }