protected void btnSubmit_Click(object sender, EventArgs e) { var horoscopeID = horoscopeExists(Convert.ToInt32(ddlZodiac.SelectedValue), Convert.ToDateTime(txtDate.Text)); if (horoscopeID == 0) { Horoscope horoscope = new Horoscope(); horoscope.Zodiac_ID = Convert.ToInt32(ddlZodiac.SelectedValue); horoscope.Date = Convert.ToDateTime(txtDate.Text); horoscope.Horoscope_English = txtHoroscope.Text; db.Horoscopes.InsertOnSubmit(horoscope); } else { Horoscope horoscope = db.Horoscopes.Where(n => n.Id == horoscopeID).SingleOrDefault(); horoscope.Zodiac_ID = Convert.ToInt32(ddlZodiac.SelectedValue); horoscope.Date = Convert.ToDateTime(txtDate.Text); horoscope.Horoscope_English = txtHoroscope.Text; } db.SubmitChanges(); Response.Redirect(Request.RawUrl); }
partial void DeleteHoroscope(Horoscope instance);
partial void UpdateHoroscope(Horoscope instance);
partial void InsertHoroscope(Horoscope instance);