protected void save_Click(object sender, EventArgs e) { string selectedValue = rblist1.SelectedValue; if (selectedValue == "1") { CalC.DataAccess.breakfast newBreakFast = new DataAccess.breakfast(); newBreakFast.user_id = 1; newBreakFast.food_id = 1; newBreakFast.serving = "100"; CalC.Business.BreakfastTablecs.BreakfastEkle(newBreakFast); } else if (selectedValue == "2") { CalC.DataAccess.lunch newlunch = new DataAccess.lunch(); newlunch.user_id = 1; newlunch.food_id = 1; newlunch.serving = "100"; CalC.Business.LunchTablecs.LunchEkle(newlunch); } else if (selectedValue == "3") { CalC.DataAccess.dinner newDinnert = new DataAccess.dinner(); newDinnert.user_id = 1; newDinnert.food_id = 1; newDinnert.serving = "100"; CalC.Business.DinnerTable.DinnertEkle(newDinnert); } }
public static void LunchEkle(CalC.DataAccess.lunch food) { CalC.DataAccess.Entities ent = new DataAccess.Entities(); ent.lunch.Add(food); ent.SaveChanges(); }