public ActionResult RideHappyOutput(int?id) //* Outputs Ride Happy PDF for specific Feedback ID *// { if (User.IsInRole("Admin")) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FeedBackForm feedBackForm = db.FeedBackForm.Find(id); if (feedBackForm == null) { return(HttpNotFound()); } return(new ViewAsPdf("RideHappyOutput", feedBackForm) { PageOrientation = Orientation.Portrait, //PageWidth = 88.9, //PageHeight = 152.4, PageMargins = new Margins(0, 0, 0, 0), //CustomSwitches = "--disable-smart-shrinking" }); } return(RedirectToAction("Index", "Home")); }
public ActionResult DeleteConfirmed(int id) { FeedBackForm feedBackForm = db.FeedBackForm.Find(id); db.FeedBackForm.Remove(feedBackForm); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "UserId,Ques1,Rating,Description")] FeedBackForm feedBackForm) { if (ModelState.IsValid) { db.FeedBackForms.Add(feedBackForm); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Ques1 = new SelectList(db.AdminFeedbackForms, "Ques1", "Ques1", feedBackForm.Ques1); return(View(feedBackForm)); }
public ActionResult Edit([Bind(Include = "FeedbackID,FeedbackDescription,DateofRide,TimeofRide,RouteName,VehNum,CustomerID,BatchID")] FeedBackForm feedBackForm) { if (ModelState.IsValid) { db.Entry(feedBackForm).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BatchID = new SelectList(db.Batch, "BatchID", "TrackingNo", feedBackForm.BatchID); ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "FirstName", feedBackForm.CustomerID); return(View(feedBackForm)); }
// GET: FeedBackForms/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FeedBackForm feedBackForm = db.FeedBackForm.Find(id); if (feedBackForm == null) { return(HttpNotFound()); } return(View(feedBackForm)); }
// GET: FeedBackForms/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FeedBackForm feedBackForm = db.FeedBackForm.Find(id); if (feedBackForm == null) { return(HttpNotFound()); } ViewBag.BatchID = new SelectList(db.Batch, "BatchID", "TrackingNo", feedBackForm.BatchID); ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "FirstName", feedBackForm.CustomerID); return(View(feedBackForm)); }
// GET: FeedBackForms/Details/5 public ActionResult Details(int?id) { if (User.IsInRole("Admin")) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FeedBackForm feedBackForm = db.FeedBackForm.Find(id); if (feedBackForm == null) { return(HttpNotFound()); } return(View(feedBackForm)); } return(RedirectToAction("Index", "Home")); }
public ActionResult Index() { if (User.IsInRole("Admin")) { FeedBackRelayViewModel x = new FeedBackRelayViewModel(); FeedBackForm feedBackForm = new FeedBackForm(); x.Forms = (from a in db.FeedBackForm where a.BatchID == null select a).OrderByDescending(p => p.DateofRide).ToList(); //gets all the forms that have not been batched and assigns them to the viewmodel x.BatchAll = false; // initlaizeing the batchall variable in the viewmodel foreach (var item in x.Forms) { var startDate = item.DateofRide; /*(from a in db.FeedBackForm where a.DateofRide == a.DateofRide select a)*/; var endDate = DateTime.Now; var daysLeft = (int)((endDate - startDate).TotalDays); if (daysLeft >= 8) { item.isDanger = true; x.HasDanger = true; } } return(View(x)); } return(RedirectToAction("FeedBackIndex", "Manage")); }