public ActionResult DeleteConfirmed(int id) { AspNetStudent_Discount aspNetStudent_Discount = db.AspNetStudent_Discount.Find(id); db.AspNetStudent_Discount.Remove(aspNetStudent_Discount); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,StudentID,DiscountID,Percentage")] AspNetStudent_Discount aspNetStudent_Discount) { if (ModelState.IsValid) { db.Entry(aspNetStudent_Discount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DiscountID = new SelectList(db.AspNetDiscountTypes, "Id", "TypeName", aspNetStudent_Discount.DiscountID); ViewBag.StudentID = new SelectList(db.AspNetUsers, "Id", "Email", aspNetStudent_Discount.StudentID); return(View(aspNetStudent_Discount)); }
public ActionResult AddStudent_Discount(List <student_discount> student_discount) { foreach (var item in student_discount) { AspNetStudent_Discount studentdiscount = new AspNetStudent_Discount(); studentdiscount.StudentID = item.StudentID; studentdiscount.Percentage = item.Percent; studentdiscount.DiscountID = item.DiscountID; db.AspNetStudent_Discount.Add(studentdiscount); db.SaveChanges(); } return(RedirectToAction("Index")); }
// GET: AspNetStudent_Discount/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AspNetStudent_Discount aspNetStudent_Discount = db.AspNetStudent_Discount.Find(id); if (aspNetStudent_Discount == null) { return(HttpNotFound()); } return(View(aspNetStudent_Discount)); }
// GET: AspNetStudent_Discount/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AspNetStudent_Discount aspNetStudent_Discount = db.AspNetStudent_Discount.Find(id); if (aspNetStudent_Discount == null) { return(HttpNotFound()); } ViewBag.DiscountID = new SelectList(db.AspNetDiscountTypes, "Id", "TypeName", aspNetStudent_Discount.DiscountID); ViewBag.StudentID = new SelectList(db.AspNetUsers, "Id", "Email", aspNetStudent_Discount.StudentID); return(View(aspNetStudent_Discount)); }