public ActionResult add_money(string Donation_Quantity) { if (Donation_Quantity == "") { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Donation_Line don = new Donation_Line(); var Donation_Type = db.Donation_Type.Where(z => z.Donation_Type_Name == "Money").FirstOrDefault(); don.Donation_Quantity = Convert.ToDecimal(Donation_Quantity); if (Donation_Type == null) { return(View("AddDonation", flex)); } don.Donation_Type = Donation_Type; don.Donation_Type_ID = Donation_Type.Donation_Type_ID; donlist.Add(don); //flex.donor flex.adddonationlist = donlist; if (flex.stock == null) { return(HttpNotFound()); } return(View("AddDonation", flex)); }
public ActionResult add_stock(string Donation_Quantity) { if (Donation_Quantity == "") { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Donation_Line dl = new Donation_Line(); dl.Donation_Quantity = Convert.ToInt32(Donation_Quantity); dl.Stock = flex.stock; dl.Stock_ID = flex.stock.Stock_ID; var Donation_Type = db.Donation_Type.Where(z => z.Donation_Type_Name == "Stock").FirstOrDefault(); if (Donation_Type == null) { return(View("AddDonation", flex)); } dl.Donation_Type = Donation_Type; dl.Donation_Type_ID = Donation_Type.Donation_Type_ID; donlist.Add(dl); if (donlist == null) { return(View("AddDonation", flex)); } flex.adddonationlist = donlist; return(View("AddDonation", flex)); }
public ActionResult DeleteConfirmed(int id) { Donation_Line donation_Line = db.Donation_Line.Find(id); db.Donation_Line.Remove(donation_Line); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "DL_ID,DL_Description,Donation_ID,Payment_ID")] Donation_Line donation_Line) { if (ModelState.IsValid) { db.Entry(donation_Line).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Donation_ID = new SelectList(db.Donations, "Donation_ID", "Donation_ID", donation_Line.Donation_ID); ViewBag.Payment_ID = new SelectList(db.Payments, "Payment_ID", "Details", donation_Line.Payment_ID); return(View(donation_Line)); }
// GET: Donation_Line/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Donation_Line donation_Line = db.Donation_Line.Find(id); if (donation_Line == null) { return(HttpNotFound()); } return(View(donation_Line)); }
// GET: Donation_Line/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Donation_Line donation_Line = db.Donation_Line.Find(id); if (donation_Line == null) { return(HttpNotFound()); } ViewBag.Donation_ID = new SelectList(db.Donations, "Donation_ID", "Donation_ID", donation_Line.Donation_ID); ViewBag.Payment_ID = new SelectList(db.Payments, "Payment_ID", "Details", donation_Line.Payment_ID); return(View(donation_Line)); }
public ActionResult Addmoneytolist(Donation_Line donation_line, string[] checkeds, string button) { ViewBag.errormessage = ""; List <Donation_Line> temp = new List <Donation_Line>(); if (button == "Select Donor") { try { flex.donor = db.Donors.Find(donation_line.Donation.Donor.Donor_ID); } catch (Exception e) { ViewBag.errormessage = ""; } return(RedirectToAction("AddDonation")); } if (button == "Add Money") { try { flex.Stocklist = db.Stocks.ToList(); } catch (Exception e) { ViewBag.errormessage = ""; } return(RedirectToAction("AddDonation")); } if (button == "Add Stock") { try { flex.Stocklist = db.Stocks.ToList(); } catch (Exception e) { ViewBag.errormessage = ""; } return(RedirectToAction("AddDonation")); } if (button == "Save") { try { flex.Stocklist = db.Stocks.ToList(); } catch (Exception e) { ViewBag.errormessage = ""; } return(RedirectToAction("AddDonation")); } if (button == "Cancel") { try { flex.Stocklist = db.Stocks.ToList(); } catch (Exception e) { ViewBag.errormessage = ""; } return(RedirectToAction("AddDonation")); } return(RedirectToAction("AddDonation")); }