public async Task <ActionResult> DeleteConfirmed(int id) { TransportCharges transportCharges = await db.TransportCharges.FindAsync(id); db.TransportCharges.Remove(transportCharges); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "TID,AreaName,Amount")] TransportCharges transportCharges) { if (ModelState.IsValid) { db.Entry(transportCharges).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(transportCharges)); }
public async Task <ActionResult> Create([Bind(Include = "TID,AreaName,Amount")] TransportCharges transportCharges) { if (ModelState.IsValid) { db.TransportCharges.Add(transportCharges); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(transportCharges)); }
// GET: TransportCharges/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TransportCharges transportCharges = await db.TransportCharges.FindAsync(id); if (transportCharges == null) { return(HttpNotFound()); } return(View(transportCharges)); }
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)); }