public ActionResult Checkout() { try { CartDAO cardao = new CartDAO(); IList <Cart> cart = cardao.GetUserCart(int.Parse(Session["Id"].ToString())); if (Session["Id"] != null && cart.Count() != 0) { UserDAO udao = new UserDAO(); CountryDAO cdao = new CountryDAO(); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.User = u; ViewBag.CountryUser = cdao.SearchById(u.CountryId); ViewBag.Cart = cardao.SearchCartUser(int.Parse(Session["Id"].ToString())); ViewBag.FullCart = cart; return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("../Home/Index")); } }
public ActionResult ProfileView() { try { if (Session["Id"] != null) { UserDAO dao = new UserDAO(); User u = dao.SearchById(int.Parse(Session["Id"].ToString())); CountryDAO cdao = new CountryDAO(); LanguageDAO ldao = new LanguageDAO(); CartDAO cardao = new CartDAO(); if (Session["Id"] != null) { ViewBag.Cart = cardao.SearchCartUser(int.Parse(Session["Id"].ToString())); } ViewBag.User = u; ViewBag.Country = cdao.List(); ViewBag.Lang = ldao.List(); ViewBag.UserCountry = cdao.SearchById(u.CountryId); return(View()); } return(RedirectToAction("../Home/Index")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult ProfileView() { try { if (Session["DevId"] != null) { DeveloperDAO dao = new DeveloperDAO(); ApplicationDAO appdao = new ApplicationDAO(); UserDAO udao = new UserDAO(); CountryDAO cdao = new CountryDAO(); Developer dev = dao.SearchById(int.Parse(Session["DevId"].ToString())); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); CartDAO cardao = new CartDAO(); if (Session["Id"] != null) { ViewBag.Cart = cardao.SearchCartUser(int.Parse(Session["Id"].ToString())); } ViewBag.DevGames = appdao.GetDevGames(dev.Id); ViewBag.Dev = dev; ViewBag.User = u; ViewBag.CountryUser = cdao.SearchById(u.CountryId); return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
internal AnonymousUserFacade() { LoginToken = null; _airlineDAO = new AirlineDAO(); _flightDAO = new FlightDAO(); _countryDAO = new CountryDAO(); }
public IList <ICountryVO> RetrieveAllCountries() { if (countryCache.Count == 0) { countryCache = CountryDAO.RetrieveAllCountries(); } return(countryCache); }
public ActionResult Register() { try { UserDAO dao = new UserDAO(); CountryDAO cdao = new CountryDAO(); LanguageDAO ldao = new LanguageDAO(); ViewBag.Class = ""; ViewBag.User = new User(); ViewBag.Country = cdao.List(); ViewBag.Lang = ldao.List(); return(View()); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Validate(User user) { try { if (ModelState.IsValid) { if (user.Password.Length > 4) { if (user.BirthDate <= DateTime.Now && user.BirthDate.Year >= 1900) { UserDAO dao = new UserDAO(); if (!dao.IsUnique(user)) { user.CrtDate = DateTime.Now; user.Picture = "../../../media/default/default-user.png"; dao.Add(user); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("user.NotUniq", "Username Already been used"); } else { ModelState.AddModelError("user.BirthNA", "Your birth Date is not acceptable"); } } else { ModelState.AddModelError("user.Password4", "Your password needs to be at least 5 characters"); } } CountryDAO cdao = new CountryDAO(); LanguageDAO ldao = new LanguageDAO(); ViewBag.User = user; ViewBag.Class = "alert alert-danger"; ViewBag.Country = cdao.List(); ViewBag.Lang = ldao.List(); return(View("Register")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Remove(int id) { try { if (Session["ModId"] != null) { CountryDAO dao = new CountryDAO(); Country c = dao.SearchById(id); dao.Remove(c); return(RedirectToAction("Index")); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Validate(Country country) { try { if (ModelState.IsValid) { CountryDAO dao = new CountryDAO(); if (dao.IsUnique(country)) { dao.Add(country); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); } ViewBag.Country = country; return(View("Index")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Index() { try { string x = Session["ModId"].ToString(); if (Session["ModId"] != null) { CountryDAO dao = new CountryDAO(); UserDAO udao = new UserDAO(); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.User = u; ViewBag.Country = new Country(); ViewBag.Countries = dao.List(); return(View()); } return(RedirectToAction("../Home/Index")); } catch { return(RedirectToAction("../Home/Index")); } }
public ActionResult EditConfirm(Country country) { try { if (Session["ModId"] != null) { CountryDAO dao = new CountryDAO(); Country g = dao.SearchById(country.Id); g.Name = country.Name; dao.Update(); return(RedirectToAction("Index")); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult ChangePassword(string cpsw, string npsw) { try { UserDAO dao = new UserDAO(); User u = dao.SearchById(int.Parse(Session["Id"].ToString())); if (cpsw != null && npsw != null && cpsw != npsw && u.Password == cpsw) { if (npsw.Length > 4) { u.Password = npsw; dao.Update(); return(RedirectToAction("ProfileView")); } else { ModelState.AddModelError("user.Password4", "Your password needs to be at least 5 characters"); } } else { ModelState.AddModelError("user.PasswordDM", "Your password don't match"); } User u2 = dao.SearchById(int.Parse(Session["Id"].ToString())); CountryDAO cdao = new CountryDAO(); LanguageDAO ldao = new LanguageDAO(); ViewBag.User = u2; ViewBag.Country = cdao.List(); ViewBag.UserCountry = cdao.SearchById(u.CountryId); ViewBag.Lang = ldao.List(); //result = "Error"; //return Json(result, JsonRequestBehavior.AllowGet); return(View("ProfileView")); } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult Edit(int id) { try { if (Session["ModId"] != null) { CountryDAO dao = new CountryDAO(); UserDAO udao = new UserDAO(); User u = udao.SearchById(int.Parse(Session["Id"].ToString())); ViewBag.User = u; ViewBag.Country = dao.SearchById(id); return(View()); } else { return(RedirectToAction("../Home/Index")); } } catch { return(RedirectToAction("Index", "Home")); } }
public Countries() { countries = new CountryDAO(); }
internal AnonymousUserFacade() { _airlineDAO = new AirlineDAO(); _flightDAO = new FlightDAO(); _countryDAO = new CountryDAO(); }
public CountryController() { countryDAO = new CountryDAO(); }