public ActionResult SignUp(EmployeeRegisterView regEmp) { using (GerGarageDbEntities db = new GerGarageDbEntities()) { EmployeeRegistry emp = new EmployeeRegistry(); emp.EmployeeFirstName = regEmp.EmployeeFirstName; emp.EmployeeLastName = regEmp.EmployeeLastName; emp.EmployeeContact = regEmp.EmployeeContact; emp.EmployeeEmailId = regEmp.EmployeeEmailId; emp.EmployeePassword = regEmp.EmployeePassword; EmployeeLogin logEmp = new EmployeeLogin(); logEmp.EmployeeEmailId = regEmp.EmployeeEmailId; logEmp.EmployeePassword = regEmp.EmployeePassword; if (ModelState.IsValid) { db.EmployeeRegistries.Add(emp); db.EmployeeLogins.Add(logEmp); db.SaveChanges(); return(RedirectToAction("Login")); } return(View()); } }
public List <BookingStatusTable> GetStatusTables() { GerGarageDbEntities db = new GerGarageDbEntities(); List <BookingStatusTable> bookingStatus = db.BookingStatusTables.ToList(); return(bookingStatus); }
public ActionResult Booking(CustomerAppointment custBooking) { using (GerGarageDbEntities db = new GerGarageDbEntities()) { CustomersBooking booking = new CustomersBooking(); JobDetail jobCard = new JobDetail(); jobCard.BookingId = custBooking.BookingId; booking.BookingDate = custBooking.BookingDate; booking.CustomerName = custBooking.CustomerName; jobCard.CustomerName = custBooking.CustomerName; booking.CustomerEmail = custBooking.CustomerEmail; booking.VehicleMake = custBooking.VehicleMake; jobCard.CarMake = custBooking.VehicleMake; booking.VehicleModel = custBooking.VehicleModel; jobCard.CarModel = custBooking.VehicleModel; booking.VehicleNumber = custBooking.VehicleNumber; jobCard.CarNumber = custBooking.VehicleNumber; booking.VehicleFuelType = custBooking.VehicleFuelType; booking.ServiceType = custBooking.ServiceType; jobCard.ServiceType = custBooking.ServiceType; booking.ServiceDate = custBooking.ServiceDate; jobCard.ServiceDate = custBooking.ServiceDate; booking.Remarks = custBooking.Remarks; jobCard.CustomerMessage = custBooking.Remarks; db.CustomersBookings.Add(booking); db.JobDetails.Add(jobCard); db.SaveChanges(); } ViewData["Confirmed"] = "Your Booking was succesfull"; return(RedirectToAction("Home,Index")); }
public List <EmployeeRegistry> GetEmployees() { GerGarageDbEntities db = new GerGarageDbEntities(); List <EmployeeRegistry> employeeRegistries = db.EmployeeRegistries.ToList(); return(employeeRegistries); }
public List <ServicesAvailable> GetServicesAvailables() { GerGarageDbEntities db = new GerGarageDbEntities(); List <ServicesAvailable> servicesAvailables = db.ServicesAvailables.ToList(); return(servicesAvailables); }
/*The following code is to fetch data from the Vehicle Type DB and populate them in the Drop Down List*/ public List <VehicleMake> GetVehicleMakes() { GerGarageDbEntities db = new GerGarageDbEntities(); List <VehicleMake> vehicleMakes = db.VehicleMakes.ToList(); return(vehicleMakes); }
public ActionResult SignUp(UserRegisterView regUser) { using (GerGarageDbEntities db = new GerGarageDbEntities()) { CustomerRegistry user = new CustomerRegistry(); user.CustomerFirstName = regUser.CustomerFirstName; user.CustomerLastName = regUser.CustomerLastName; user.CustomerContact = regUser.CustomerContact; user.CustomerEmailId = regUser.CustomerEmailId; user.CustomerPassword = regUser.CustomerPassword; user.CustomerAddress = regUser.CustomerAddress; user.CustomerPostalCode = regUser.CustomerPostalCode; CustomerLogin logUser = new CustomerLogin(); logUser.CustomerEmailId = regUser.CustomerEmailId; logUser.CustomerPassword = regUser.CustomerPassword; if (ModelState.IsValid) { db.CustomerRegistries.Add(user); db.CustomerLogins.Add(logUser); db.SaveChanges(); return(RedirectToAction("Login")); } return(View()); } }
public ActionResult Booking() { GerGarageDbEntities db = new GerGarageDbEntities(); ViewBag.VehicleList = new SelectList(db.VehicleMakes, "VehicleBrand", "VehicleBrand"); ViewBag.ServiceList = new SelectList(db.ServicesAvailables, "ServiceName", "ServiceName"); return(View()); }
public ActionResult GenerateInvoice(int id) { using (GerGarageDbEntities db = new GerGarageDbEntities()) { JobDetail jd = db.JobDetails.FirstOrDefault(c => c.JobNumber == id); var report = new PartialViewAsPdf("~/Views/Shared/Invoice.cshtml", jd); return(report); } }
public ActionResult Login(RegisteredEmployee regEmp) { using (var context = new GerGarageDbEntities()) { bool isValid = context.EmployeeLogins.Any(x => x.EmployeeEmailId == regEmp.EmployeeEmailId && x.EmployeePassword == regEmp.EmployeePassword); if (isValid) { FormsAuthentication.SetAuthCookie(regEmp.EmployeeEmailId, false); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "Invalid Login Credentials!!!!"); } return(View()); }