public ActionResult EditUser(int id) { var repo = VehicleRepoFactory.Create(); var emp = repo.GetEmployeeByID(id); return(View(emp)); }
public ActionResult ContactUs(ContactUs ct) { var repo = VehicleRepoFactory.Create(); var context = new CarDealershipDBContext(); if (ModelState.IsValid) { ContactUs contact = new ContactUs { ContactUsID = ct.ContactUsID, Email = ct.Email, FirstName = ct.FirstName, LastName = ct.LastName, Message = ct.Message, Phone = ct.Phone, Date = DateTime.Now }; repo.AddContact(contact); return(RedirectToAction("Index", "Home")); } else { return(View(ct)); } }
public ActionResult VehicleDetails(int id) { var repo = VehicleRepoFactory.Create(); Vehicle model = new Vehicle(); model = repo.GetVehicleByID(id); return(View(model)); }
public ActionResult AddMake(Make m) { m.AddedDate = DateTime.Today.Date; m.AddedBy = User.Identity.Name; var repo = VehicleRepoFactory.Create(); repo.AddMake(m); return(RedirectToAction("Makes", "admin")); }
public ActionResult EditUser(Employee emp) { CarDealershipDBContext context = new CarDealershipDBContext(); var userMgr = new UserManager <AppUser>(new UserStore <AppUser>(context)); var repo = VehicleRepoFactory.Create(); var user = userMgr.FindByName(emp.OldUserName); { user.UserName = emp.UserName; user.Email = emp.Email; }; userMgr.Update(user); userMgr.ChangePassword(user.Id, emp.OldPassword, emp.Password); repo.EditEmployee(emp); return(RedirectToAction("Users", "admin")); }
public ActionResult AddUser(Employee m) { CarDealershipDBContext context = new CarDealershipDBContext(); var repo = VehicleRepoFactory.Create(); var userMgr = new UserManager <AppUser>(new UserStore <AppUser>(context)); if (!userMgr.Users.Any(u => u.UserName == m.UserName)) { var newUser = new AppUser() { UserName = m.UserName, Email = m.Email }; userMgr.Create(newUser, m.Password); context.SaveChanges(); userMgr.AddToRole(newUser.Id, m.Role); repo.AddEmployee(m); } return(RedirectToAction("Index", "Home")); }
public IHttpActionResult vehicleModels(string make) { var repo = VehicleRepoFactory.Create(); return(Ok(repo.GetModelsByMake(make))); }
public IHttpActionResult vehicleVin(string vin) { var repo = VehicleRepoFactory.Create(); return(Ok(repo.GetVehicleByVin(vin))); }
public IHttpActionResult vehicleDetails(int id) { var repo = VehicleRepoFactory.Create(); return(Ok(repo.GetVehicleByID(id))); }
public IHttpActionResult QuickSearch(string Type, string SearchKey, int YearMin, int YearMax, int PriceMin, int PriceMax) { var repo = VehicleRepoFactory.Create(); return(Ok(repo.QuickSearch(Type, SearchKey, YearMin, YearMax, PriceMin, PriceMax))); }
public IHttpActionResult Get() { var repo = VehicleRepoFactory.Create(); return(Ok(repo.GetFeaturedVehicles())); }
public IHttpActionResult GetAll() { var repo = VehicleRepoFactory.Create(); return(Ok(repo.GetSpecials())); }