Esempio n. 1
0
        public override void Login()
        {
            Console.WriteLine("Please type your desired name:");
            var name = Console.ReadLine();

            _connectionService.Create(name);
            _connectionService.SetConnectionStrategy(new ConnectionLogin());
            _connectionService.Run();
            _me = _connectionService.GetMe();
            Console.WriteLine("Hello " + _me.Name);
            Console.WriteLine("You have " + _me.Money + " zł");
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("DefaultCorsPolicyName", builder =>
                {
                    builder
                    .AllowAnyOrigin()     //TODO: Will be replaced by above when Microsoft releases microsoft.aspnetcore.cors 2.0 - https://github.com/aspnet/CORS/pull/94
                    .AllowAnyHeader()
                    .AllowAnyMethod();
                });
            });
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            var t        = ConnectionService.Create();
            var database = t.GetDatabase() as IMongoDatabase;

            services.AddSingleton(typeof(ITaskRepository), new TaskRepository(database));
            services.AddSingleton <ITaskService, TaskService>();
        }