public ActionResult Create(Donation donation) { if (ModelState.IsValid) { db.Donations.Add(donation); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(donation)); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { CommunityAssistEntities1 cae = new CommunityAssistEntities1(); Donation d = new Donation(); int pk = (int)Session["personKey"]; d.DonationAmount = Decimal.Parse(txtDonation.Text); d.DonationDate = DateTime.Now; d.PersonKey = pk; cae.Donations.Add(d); cae.SaveChanges(); Response.Redirect("Confirmation.aspx"); } catch (Exception ex) { lblError.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { CommunityAssistEntities1 cae = new CommunityAssistEntities1(); Donation d = new Donation(); int pk = (int)Session["personKey"]; d.DonationAmount = Decimal.Parse(txtDonation.Text); d.DonationDate = DateTime.Now; d.PersonKey = pk; cae.Donations.Add(d); cae.SaveChanges(); Response.Redirect("Confirmation.aspx"); } catch (Exception ex) { lblError.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { CommunityAssistEntities1 cae = new CommunityAssistEntities1(); ServiceGrant sg = new ServiceGrant(); int pk = (int)Session["personKey"]; sg.ServiceKey = int.Parse(ddlGrantType.SelectedValue.ToString()); sg.GrantAmount = Decimal.Parse(txtGrantAmount.Text); sg.GrantDate = DateTime.Now; sg.GrantNeedExplanation = txtExplanation.Text; sg.PersonKey = pk; cae.ServiceGrants.Add(sg); cae.SaveChanges(); Response.Redirect("Confirmation.aspx"); } catch (Exception ex) { lblError.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { CommunityAssistEntities1 cae = new CommunityAssistEntities1(); ServiceGrant sg = new ServiceGrant(); int pk = (int)Session["personKey"]; sg.ServiceKey = int.Parse(ddlGrantType.SelectedValue.ToString()); sg.GrantAmount = Decimal.Parse(txtGrantAmount.Text); sg.GrantDate = DateTime.Now; sg.GrantNeedExplanation = txtExplanation.Text; sg.PersonKey = pk; cae.ServiceGrants.Add(sg); cae.SaveChanges(); Response.Redirect("Confirmation.aspx"); } catch (Exception ex) { lblError.Text = ex.Message; } }