public IActionResult <IEnumerable <string> > Categories(HttpSession session) { AuthenticatedManager.GetAuthenticatedUser(session.Id); IEnumerable <string> categoryNames = this.service.GetCategoryNames(); return(this.View(categoryNames)); }
public IActionResult <IEnumerable <TopicViewModel> > Topics(HttpSession session) { AuthenticatedManager.GetAuthenticatedUser(session.Id); IEnumerable <TopicViewModel> topics = service.GetTopTenLatestTopics(); return(this.View(topics)); }
public IActionResult Add(HttpResponse response, HttpSession session) { if (!AuthenticatedManager.IsAdmin(session.Id)) { this.Redirect(response, "/user/login"); } return(this.View()); }
public IActionResult <IEnumerable <TopicViewModel> > Topics(HttpSession session, string categoryName) { AuthenticatedManager.GetAuthenticatedUser(session.Id); IEnumerable <TopicViewModel> topics = this.service.GetCategoryTopicsViewModels(categoryName); return(this.View(topics)); }
private bool IsAuthenticated(string sessionId, HttpResponse response) { if (AuthenticatedManager.IsAuthenticated(sessionId)) { this.Redirect(response, "/home/topics"); return(true); } return(false); }
public ActionResult Add() { var httpCookies = this.Request.Cookies.Get("sessionId"); if (httpCookies == null || !AuthenticatedManager.IsAuthenticated(httpCookies.Value)) { return(this.RedirectToAction("All")); } return(this.View()); }
public ActionResult AddConfirmation(AddSalesConfirmationViewModel vm) { var cookie = this.Request.Cookies.Get("sessionId"); if (cookie == null || !AuthenticatedManager.IsAuthenticated(cookie.Value)) { return(this.RedirectToAction("Login", "Users")); } return(View(vm)); }
public void Edit(HttpResponse response, HttpSession session, EditGameBindingModel bind) { if (!AuthenticatedManager.IsAdmin(session.Id)) { this.Redirect(response, "/user/login"); } this.service.EditGame(bind); this.Redirect(response, "/game/managing"); }
public void Delete(HttpResponse response, HttpSession session, DeleteViewModel bind) { if (!AuthenticatedManager.IsAdmin(session.Id)) { this.Redirect(response, "/user/login"); } this.service.Delete(bind.Id); this.Redirect(response, "/game/managing"); }
public ActionResult Login() { var httpCookies = this.Request.Cookies.Get("sessionId"); if (httpCookies != null && AuthenticatedManager.IsAuthenticated(httpCookies.Value)) { return(this.RedirectToAction("All", "Cars")); } return(View()); }
public void Buy(HttpResponse response, HttpSession session, BuyGameBindingModel bind) { if (!AuthenticatedManager.IsAuthenticated(session.Id)) { this.Redirect(response, "/user/login"); } User currentUser = AuthenticatedManager.GetAuthenticatedUser(session.Id); this.service.BuyGameForUser(currentUser, bind); this.Redirect(response, "/home/games?filter=owned"); }
public ActionResult Logout() { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticatedManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("Login")); } AuthenticatedManager.Logout(Request.Cookies.Get("sessionId").Value); return(this.RedirectToAction("All", "Cars")); }
public IActionResult <EditViewModel> Edit(HttpResponse response, HttpSession session, int id) { if (!AuthenticatedManager.IsAdmin(session.Id)) { this.Redirect(response, "/user/login"); } EditViewModel model = this.service.GetEditViewModel(id); return(this.View(model)); }
public ActionResult AddConfirmation(AddSaleBindingModel bind) { var cookie = this.Request.Cookies.Get("sessionId"); if (cookie == null || !AuthenticatedManager.IsAuthenticated(cookie.Value)) { return(this.RedirectToAction("Login", "Users")); } this.service.AddSale(bind); return(this.RedirectToAction("All")); }
public IActionResult <GameDetailsViewModel> Info(HttpSession session, HttpResponse response, int id) { if (!AuthenticatedManager.IsAuthenticated(session.Id)) { this.Redirect(response, "/user/login"); return(null); } GameDetailsViewModel model = this.service.GetGameDetailsViewModel(id); return(this.View(model)); }
public void Info(HttpSession session, HttpResponse response, GameDetailsViewModel model) { User user = AuthenticatedManager.GetAuthenticatedUser(session.Id); if (user == null) { this.Redirect(response, "/home/games"); return;; } this.service.GetGameFromViewModel(model); }
public ActionResult All(string username, int?page) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticatedManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("All", "Suppliers")); } AllLogsPageViewModel vm = this.service.GetAllLogsPageVm(username, page); return(View(vm)); }
public IActionResult <AllViewModel> Games(HttpSession session, HttpResponse response, string filter) { if (!AuthenticatedManager.IsAuthenticated(session.Id)) { this.Redirect(response, "/user/login"); return(null); } User currentUser = AuthenticatedManager.GetAuthenticatedUser(session.Id); var model = this.service.GetAllViewModel(filter, currentUser); return(this.View(model)); }
public ActionResult DeleteAlll() { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticatedManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("All", "Suppliers")); } this.service.DeleteAllLogs(); return(this.RedirectToAction("All", "Suppliers")); }
public ActionResult Add() { var cookie = this.Request.Cookies.Get("sessionId"); if (cookie == null || !AuthenticatedManager.IsAuthenticated(cookie.Value)) { return(this.RedirectToAction("Login", "Users")); } AddSaleViewModel vm = this.service.GetSalesViewModel(); return(View(vm)); }
public ActionResult Add([Bind(Include = "Name,IsImporter")] AddSupplierBindingModel bind) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticatedManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("All")); } User loggedInUser = AuthenticatedManager.GetAuthenticatedUsers(httpCookie.Value); this.service.AddSupplier(bind, loggedInUser.Id); return(this.RedirectToAction("All")); }
public void Details(HttpRequest request, HttpSession session, HttpResponse response, DetailsReplyBindingModel bind) { User user = AuthenticatedManager.GetAuthenticatedUser(session.Id); if (user == null) { this.Redirect(response, "/home/topics"); return; } this.service.AddNewReply(bind, user); this.Redirect(response, request.Url); }
public IActionResult <IEnumerable <string> > New(HttpSession session, HttpResponse response) { User currentUser = AuthenticatedManager.GetAuthenticatedUser(session.Id); if (currentUser == null) { this.Redirect(response, "/home/topics"); } IEnumerable <string> categoryName = this.service.GetCategoryNames(); return(this.View(categoryName)); }
public ActionResult Edit(int id) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticatedManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("All")); } EditSupplierViewModel vm = this.service.GetEditSupplierVm(id); return(this.View(vm)); }
public IActionResult <DetailsViewModel> Details(int id, HttpSession session, HttpResponse response) { User user = AuthenticatedManager.GetAuthenticatedUser(session.Id); if (user == null) { this.Redirect(response, "/home/topics"); return(null); } DetailsViewModel viewModel = this.service.GetDetailsViewModel(id); return(this.View(viewModel)); }
public IActionResult <ProfileViewModel> Profile(HttpSession session, int id) { User user = AuthenticatedManager.GetAuthenticatedUser(session.Id); int currentUser = -1; if (user != null) { currentUser = user.Id; } ProfileViewModel topics = this.service.GetProfileViewModel(id, currentUser); return(this.View(topics)); }
public ActionResult Register([Bind(Include = "Username, Email, Password, ConfirmPassword")] RegisterUserBindingModel bind) { var httpCookies = this.Request.Cookies.Get("sessionId"); if (httpCookies != null && AuthenticatedManager.IsAuthenticated(httpCookies.Value)) { return(this.RedirectToAction("All", "Cars")); } if (this.ModelState.IsValid && bind.Password == bind.ConfirmPassword) { this.service.RegisterUser(bind); return(this.RedirectToAction("Login")); } return(this.RedirectToAction("Register")); }
public IActionResult <AllAdminGameViewModel> Managing(HttpSession session, HttpResponse response) { if (!AuthenticatedManager.IsAuthenticated(session.Id)) { this.Redirect(response, "/user/login"); return(null); } if (!AuthenticatedManager.IsAdmin(session.Id)) { this.Redirect(response, "/home/games"); return(null); } var model = this.service.GetAllAdminViewModel(); return(this.View(model)); }
public ActionResult Login([Bind(Include = "Username, Password")] LoginBindingModel bind) { var httpCookies = this.Request.Cookies.Get("sessionId"); if (httpCookies != null && AuthenticatedManager.IsAuthenticated(httpCookies.Value)) { return(this.RedirectToAction("All", "Cars")); } if (this.ModelState.IsValid && this.service.IsUserExists(bind)) { this.service.LoginUser(bind, Session.SessionID); this.Response.SetCookie(new HttpCookie("sessionId", Session.SessionID)); return(this.RedirectToAction("All", "Cars")); } return(this.RedirectToAction("Login")); }
public ActionResult All(string supplyerType) { var httpCookies = this.Request.Cookies.Get("sessionId"); if (httpCookies == null || !AuthenticatedManager.IsAuthenticated(httpCookies.Value)) { IEnumerable <SupplierViewModel> supplies = this.service.GetAllSuplyersByType(supplyerType); return(this.View(supplies)); } User user = AuthenticatedManager.GetAuthenticatedUsers(httpCookies.Value); ViewBag.Username = user.Username; IEnumerable <SuplierAllViewModel> vm = this.service.GetAllSupplierByTypeForUser(supplyerType); return(View("AllSuppliersForUser", vm)); }