public ActionResult Login(Membership model) { using (var context = new RailwayReservationSystemEntities1()) { /* bool isValid = context.User_Details.Any(x => x.UserId == model.UserId && x.Password == model.Password); */ //if (context.User_Details.Any(x => x.UserId == model.UserId && x.Password == model.Password)) //{ // System.Web.Security.FormsAuthentication.SetAuthCookie(model.UserId, false); // return RedirectToAction("Search", "Booking"); //} if (context.User_Details.Any(x => x.UserId == model.UserId && x.Password == model.Password && x.User_Type == "Admin")) { System.Web.Security.FormsAuthentication.SetAuthCookie(model.UserId, false); return(RedirectToAction("Index", "Train_Details")); } else if (context.User_Details.Any(x => x.UserId == model.UserId && x.Password == model.Password)) { System.Web.Security.FormsAuthentication.SetAuthCookie(model.UserId, false); return(RedirectToAction("Search", "Booking")); } else { ModelState.AddModelError("", "Invalid Username and Password"); return(View()); } } }
public ActionResult BookNow(Passenger_Details model) { using (var context = new RailwayReservationSystemEntities1()) { context.Passenger_Details.Add(model); context.SaveChanges(); } return(RedirectToAction("Amount", "Booking", model)); }
public ActionResult SignUp(User_Details model) { using (var context = new RailwayReservationSystemEntities1()) { context.User_Details.Add(model); context.SaveChanges(); } return(RedirectToAction("login")); }
public ActionResult Pay(Payment_Details model) { using (var context = new RailwayReservationSystemEntities1()) { if (context.Payment_Details.Any(x => x.Card_No == model.Card_No && x.CVV == model.CVV && x.Expiry_Date == model.Expiry_Date)) { return(RedirectToAction("RedirectFromPayment", "Payment")); } else { ModelState.AddModelError("", "Enter Correct Details"); return(View()); } } }
public ActionResult Amount(Passenger_Details model) { using (var context = new RailwayReservationSystemEntities1()) { int total = 0; var query = (from a in context.Calculate_Amount where a.PNR_No == model.PNR_No select a).SingleOrDefault(); //int db = (from a in context.Calculate_Amount select a.Total_No_Of_Seats).FirstOrDefault(); switch (query.Class) { case "General": total = 50 * query.Total_No_Of_Seats; break; case "Sleeper": total = 100 * query.Total_No_Of_Seats; break; case "AC1": total = 500 * query.Total_No_Of_Seats; break; case "AC2": total = 350 * query.Total_No_Of_Seats; break; case "AC3": total = 200 * query.Total_No_Of_Seats; break; } TempData["Result"] = total; //TempData["Result"].keep } return(RedirectToAction("Pay", "Payment")); }