Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 partial void DeleteHoroscope(Horoscope instance);
Ejemplo n.º 3
0
 partial void UpdateHoroscope(Horoscope instance);
Ejemplo n.º 4
0
 partial void InsertHoroscope(Horoscope instance);