//public List<Link> linkToShow; //public Link l; public ActionResult Index() { //int x = 1; ViewModel vm = new ViewModel(); UserManager um = new UserManager(ConnectionString); LinkManager lm = new LinkManager(ConnectionString); //ViewBag.Counter = x; vm.Alllink = lm.GetAllLinks(); return View(vm); }
public ActionResult Signin(string username, string password) { var mgr = new UserManager(ConnectionString); var user = mgr.GetUser(username, password); if (user == null) { TempData["error"] = "Incorrect User Name or Password"; return View(); } FormsAuthentication.SetAuthCookie(user.UserName, true); return RedirectToAction("Secret"); }
static void Main(string[] args) { string ConnectionString = @"Data Source=.\sqlexpress;Initial Catalog=Hacker;Integrated Security=True"; Console.WriteLine("Hello manager. This insures the safety of your program. Only authorized individuals have access to add another emplyee to the system"); Console.WriteLine(); Console.WriteLine("Please enter the individuals user name : "); Console.WriteLine("(Press enter to submit)"); Console.ReadKey(true); string username = Console.ReadLine(); Console.WriteLine("Please enter the individuals password"); string password = Console.ReadLine(); var mgr = new UserManager(ConnectionString); mgr.AddUser(username, password); Console.WriteLine("Your new user " + username + " has been created"); Console.ReadKey(true); }
public ActionResult Secret() { ViewModel vm = new ViewModel(); UserManager um = new UserManager(ConnectionString); LinkManager lm = new LinkManager(ConnectionString); string username = User.Identity.Name; vm.UserId = um.GetUserbyUsername(username); vm.LoginUsers = um.GetAllUser(); vm.User = um.GetUserbyUsernameReturnUser(username); vm.Date = DateTime.Now; vm.Alllink = lm.GetAllLinks(); vm.linksByUser = lm.GetLinkbyUsers(username); //linkToShow.Add(l); //vm.linkToShow = linkToShow; return View(vm); }
public ActionResult Users(int userId) { ViewModel vm = new ViewModel(); LinkManager lm = new LinkManager(ConnectionString); UserManager um = new UserManager(ConnectionString); IEnumerable<Link> linkById = lm.GetLinkbyUserId(userId); vm.UserId = um.GetUserId(userId); vm.linksByUser = linkById; return View(vm); }