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);
        }
示例#2
0
 partial void DeleteHoroscope(Horoscope instance);
示例#3
0
 partial void UpdateHoroscope(Horoscope instance);
示例#4
0
 partial void InsertHoroscope(Horoscope instance);