public ActionResult CheckCode() { string code = ""; var img = ValidateManager.CreateImg(out code); Session["ValidateCode"] = code; MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); return(File(ms.ToArray(), "image/jpeg")); }
void Awake() { if (s_instance == null) { s_instance = this; Init(); } else { Debug.LogWarning("Destroying duplicate Validate Manager."); DestroyImmediate(this.gameObject); } }
public async override Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { using (var _validateManager = new ValidateManager()) { Instructor user = await _validateManager.Authenticate(context.UserName, context.Password); if (user == null) { context.SetError("invalid_grant", "Kullanıcı adı ve parola uyuşmamaktadır!"); return; } var identity = new ClaimsIdentity(context.Options.AuthenticationType); identity.AddClaim(new Claim(ClaimTypes.Name, user.UserName)); identity.AddClaim(new Claim(ClaimTypes.Role, "Admin")); context.Validated(identity); } }
// GET: api/User // /*public IEnumerable<User> Get(string email,string password) * { * return ValidateManager.ValidateUser(email, password); * } */ // GET: api/User/5 /* * public User Get(string email,string password) * { * return ValidateDBManager.validateUser(email, password); * * * }*/ // POST: api/User public bool Post([FromBody] User theUser) { return(ValidateManager.ValidateUser(theUser)); }
static void Main(string[] args) { PlayerManager playerManager = new PlayerManager(); playerManager.Add(new Player() { Tc = "10808198724", Name = "İbrahim", Surname = "ALTUN", YearOfBirth = 1997 }); GameManager gameManager = new GameManager(); gameManager.Add(new Game() { Name = "GTA V", Category = "Entertainment", Price = 135 }); while (true) { Console.WriteLine("\nOptions"); Console.WriteLine("\n(PA) : Player Add " + "\n(PD) : Player Delete" + "\n(PL) : Player List" + "\n(GA) : Game Add" + "\n(GD) : Game Delete" + "\n(GL) : Game List" + "\n(CC) : Choise Campaign" + "\n(E) : Exit"); string x = Console.ReadLine(); if (x == "PA") { Console.Clear(); Console.WriteLine("Enter the Player Information you want to add..."); Console.WriteLine("Tc : "); string TcNo = Console.ReadLine(); Console.WriteLine("Name : "); string PlayerName = Console.ReadLine(); Console.WriteLine("Surname : "); string PlayerSurname = Console.ReadLine(); Console.WriteLine("Year Of Birth : "); int BirthYear = Convert.ToInt32(Console.ReadLine()); ValidateManager validateManager = new ValidateManager(); validateManager.Validate(new Person { Tc = TcNo, Name = PlayerName, Surname = PlayerSurname, YearOfBirth = BirthYear }); } else if (x == "PD") { Console.WriteLine("Enter the name of the player you want to delete: "); playerManager.Delete(Console.ReadLine()); } else if (x == "PL") { Console.Clear(); playerManager.ListPlayer(); } else if (x == "GA") { Console.WriteLine("Enter the information of the game you want to add : "); Console.WriteLine("Game Name : "); string Name = Console.ReadLine(); Console.WriteLine("Game Category : "); string Category = Console.ReadLine(); Console.WriteLine("Game Price :"); double Price = Convert.ToDouble(Console.ReadLine()); gameManager.Add(new Game() { Name = Name, Category = Category, Price = Price }); } else if (x == "GL") { Console.Clear(); gameManager.ListGame(); } else if (x == "CC") { while (true) { Console.Clear(); Console.WriteLine("Campaigns " + "\n(1) Welcome Campaign" + "\n(2) New Year Campaign " + "\n(3) Student Campaign " + "\n(4) Menü"); Console.WriteLine("--------------------------"); int x2 = Convert.ToInt32(Console.ReadLine()); if (x2 == 1) { gameManager.ListGame(); Console.WriteLine("Write the name of the game you want to apply 'Welcome Campaign' from the games above: "); string name = Console.ReadLine(); ICampaignService campaignService = new WelcomeCampaign(); gameManager.BuyGame(name, campaignService); } else if (x2 == 2) { gameManager.ListGame(); Console.WriteLine("Write the name of the game you want to apply 'New Year Campaign' from the games above: "); string name = Console.ReadLine(); ICampaignService campaignService = new NewYearCampaign(); gameManager.BuyGame(name, campaignService); } else if (x2 == 3) { gameManager.ListGame(); Console.WriteLine("Write the name of the game you want to apply 'Student Campaign' from the games above: "); string name = Console.ReadLine(); ICampaignService campaignService = new StudentCampaign(); gameManager.BuyGame(name, campaignService); } else { break; } } } else { Console.WriteLine("Exiting..."); break; } } }
static void Main(string[] args) { Gamer gamer1 = new Gamer() { Id = 1, IdentityNumber = "11111111111", Name = "Can", LastName = "Yaman", Dob = 1998 }; Gamer gamer2 = new Gamer() { Id = 2, IdentityNumber = "22222222222", Name = "Ceren", LastName = "Yaman", Dob = 2008 }; Gamer gamer3 = new Gamer() { Id = 3, IdentityNumber = "33333333333", Name = "Neslihan", LastName = "Yaman", Dob = 2004 }; IGamerServices gamerManager = new GamerManager(); gamerManager.Add(gamer1); gamerManager.Add(gamer2); gamerManager.Add(gamer3); ValidateManager validateManager = new ValidateManager(); validateManager.IsValid(gamer1); validateManager.IsValid(gamer2); validateManager.IsValid(gamer3); Game game1 = new Game() { Id = 1, Name = "GTA", Price = 100 }; Game game2 = new Game() { Id = 2, Name = "FIFA 2021", Price = 200 }; Game game3 = new Game() { Id = 3, Name = "CALL OF DUTY", Price = 300 }; IGameServices gameManager = new GameManager(); gameManager.Add(game1); gameManager.Add(game2); gameManager.Add(game3); Campaign campaign1 = new Campaign() { Id = 1, Name = "Student Campaign", StartingDate = 2020, EndDate = 2022 }; Campaign campaign2 = new Campaign() { Id = 2, Name = "Black Friday Campaign", StartingDate = 2020, EndDate = 2021 }; Campaign campaign3 = new Campaign() { Id = 3, Name = "Gamer Campaign", StartingDate = 2021, EndDate = 2022 }; ICampaignServices campaignServices = new CampaignManager(); campaignServices.Add(campaign1); campaignServices.Add(campaign2); campaignServices.Add(campaign3); gameManager.SellGame(game1, gamer1, campaign1); gameManager.SellGame(game2, gamer2, campaign2); gameManager.SellGame(game3, gamer3, campaign3); }