public async Task <ActionResult> DeleteConfirmed(int id) { FeeModule feeModule = await db.FeeModules.FindAsync(id); db.FeeModules.Remove(feeModule); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "FID,CID,Fee,AnnualCharges")] FeeModule feeModule) { if (ModelState.IsValid) { db.Entry(feeModule).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CID = new SelectList(db.SchoolClasses, "CID", "ClassName", feeModule.CID); return(View(feeModule)); }
public async Task <ActionResult> Create([Bind(Include = "FID,CID,Fee,AnnualCharges")] FeeModule feeModule) { if (ModelState.IsValid) { db.FeeModules.Add(feeModule); await db.SaveChangesAsync(); TempData["Success"] = "Saved Successfully"; return(RedirectToAction("Index")); } ViewBag.CID = new SelectList(db.SchoolClasses, "CID", "ClassName", feeModule.CID); return(View(feeModule)); }
// GET: FeeModules/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FeeModule feeModule = await db.FeeModules.FindAsync(id); if (feeModule == null) { return(HttpNotFound()); } return(View(feeModule)); }
// GET: FeeModules/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FeeModule feeModule = await db.FeeModules.FindAsync(id); if (feeModule == null) { return(HttpNotFound()); } ViewBag.CID = new SelectList(db.SchoolClasses, "CID", "ClassName", feeModule.CID); return(View(feeModule)); }
public async Task <ActionResult> Create([Bind(Include = "REGId,Session,Type,AddmissionNumber,RollNumber,CID,SCID,FirstName,LastName,Gender,DOB,CatID,Mobile,Email,AdmissionDate,Image,FatherName,FatherPhone,FatherOccupation,MotherName,MotherPhone,MotherOccupation,CurrentAddress,ParmanentAddress,AadharNumber,TID,SpecialCase,Remarks,AdmissionFee")] Registration registration, string admission, HttpPostedFileBase file, Helper Help) { if (ModelState.IsValid) { try { registration.Image = Help.uploadfile(file); var check = db.Registrations.Where(x => x.AddmissionNumber == registration.AddmissionNumber).FirstOrDefault(); if (check != null) { this.SetNotification("Admission Number Busy", NotificationEnumeration.Error); ViewBag.CatID = new SelectList(db.CatDatas, "CatID", "CategoryName", registration.CatID); ViewBag.CID = new SelectList(db.SchoolClasses, "CID", "ClassName", registration.CID); ViewBag.SCID = new SelectList(db.Sections, "SCID", "SectionName", registration.SCID); ViewBag.TID = new SelectList(db.TransportCharges, "TID", "AreaName", registration.TID); return(View()); } else { db.Registrations.Add(registration); await db.SaveChangesAsync(); FeeModule sm = db.FeeModules.Where(x => x.CID == registration.CID).FirstOrDefault(); TransportCharges tc = db.TransportCharges.Where(x => x.TID == registration.TID).FirstOrDefault(); if (sm != null) { #region Fee Structure FeeStructure fs = new FeeStructure(); fs.Date = registration.AdmissionDate; fs.AdmissionFee = Convert.ToDouble(admission); fs.AnnualCharges = sm.AnnualCharges; fs.TotalFee = (sm.Fee * Convert.ToDouble(12)); fs.TransportFee = (tc.Amount * Convert.ToDouble(12)); fs.RID = Convert.ToInt32(registration.AddmissionNumber); fs.Status = "Pending"; fs.Session = Session["session"].ToString(); fs.AnnualCharges = 0; fs.OtherCharges = 0; fs.Pay = 0; fs.Discount = 0.0; fs.Fine = 0.0; db.FeeStructures.Add(fs); db.SaveChanges(); #endregion } } } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } throw; } TempData["Success"] = "Saved Successfully"; return(RedirectToAction("Index")); } ViewBag.CatID = new SelectList(db.CatDatas, "CatID", "CategoryName", registration.CatID); ViewBag.CID = new SelectList(db.SchoolClasses, "CID", "ClassName", registration.CID); ViewBag.SCID = new SelectList(db.Sections, "SCID", "SectionName", registration.SCID); ViewBag.TID = new SelectList(db.TransportCharges, "TID", "AreaName", registration.TID); return(View(registration)); }