Пример #1
0
        static void Main(string[] args)
        {
            Account account;



            //     while ( true){
            //     AccountStore.InitDb();
            //     account = LoginScreen.DrawLogin();

            //     Console.ReadKey();
            //    }


            AccountStore.InitDb();
            account = AccountStore.FindUser("fe", "fe");
            FriendshipStore.InitDb();
            // System.Console.WriteLine(FriendshipStore.friendships.First().FirstFriend);
            RequestStore.InitDb();
            MainScreen.DrawProfile(account);


            // RequestStore.InitDb();
            // RequestStore.remove(new Friendship{ FirstFriend = 1, SecondFriend = 6});
            // RequestStore.SaveChanges();
        }
Пример #2
0
 public Task <IActionResult> Grab()
 {
     RequestStore.Push(new RequestInfo
     {
         Received   = DateTime.UtcNow,
         Method     = Request.Method,
         RequestUri = Request.QueryString.HasValue ? Request.QueryString.Value : string.Empty,
         Headers    = Request.Headers.Select(h => h.Key + " " + String.Join(" ", h.Value.ToArray())).ToArray(),
         Body       = Request.Body != null ? ReadBody(Request.Body) : string.Empty,
     });
     return(Task.FromResult <IActionResult>(Ok()));
 }
		/// <summary>
		/// Defines a new LocalizationFilter.
		/// </summary>
		/// <param name="store">Location where the localization parameter is stored.</param>
		/// <param name="key">Name of the parameter in the store.</param>
		public LocalizationFilterAttribute(RequestStore store, String key) : this()
		{
			this.key = key;
			requestStore = store;
		}
 /// <summary>
 /// Defines a new LocalizationFilter.
 /// </summary>
 /// <param name="store">Location where the localization parameter is stored.</param>
 /// <param name="key">Name of the parameter in the store.</param>
 public LocalizationFilterAttribute(RequestStore store, String key) : this()
 {
     _key          = key;
     _requestStore = store;
 }
Пример #5
0
 /// <summary>
 /// Creates a new instance of the CastleBind attribute. The name of the parameter will be used as the request prefix.
 /// </summary>
 /// <param name="requestStore">The requst store that should be used to bind the model</param>
 public CastleBindAttribute(RequestStore requestStore)
     : this(null, requestStore)
 {
 }
Пример #6
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="requestStore">The requst store that should be used to bind the model</param>
 /// <param name="prefix">Prefix to use when extract </param>
 public CastleBindAttribute(string prefix, RequestStore requestStore)
     : base(prefix, requestStore)
 {
 }
Пример #7
0
        public IActionResult Index()
        {
            var requests = RequestStore.GetAll().ToList();

            return(View(requests));
        }
 public DeserializeAttribute(string prefix, RequestStore requestStore)
     : base(prefix, requestStore)
 {
 }
Пример #9
0
 public static void Test()
 {
     RequestStore.InitDb();
     RequestStore.requests.RemoveAt(0);
     RequestStore.SaveChanges();
 }
Пример #10
0
    public static void DrawProfile(Account account)
    {
        System.Console.WriteLine("Welcome");

        // System.Console.WriteLine(account.Id);
        // System.Console.WriteLine(account.Login);
        // System.Console.WriteLine(account.Password);
        // System.Console.WriteLine(account.Surname);
        // System.Console.WriteLine(account.Name);

        var frds = AccountStore.accounts
                   .Where(x => x.Id == account.Id)
                   .Join(FriendshipStore.friendships,
                         x => x.Id,
                         y => y.SecondFriend,
                         (x, y) => x).ToList();

        friends = AccountStore.accounts.Join(FriendshipStore.friendships.Where(x => x.FirstFriend == account.Id),
                                             x => x.Id,
                                             y => y.SecondFriend,
                                             (x, y) => x).ToList();

        // foreach (var item in friends)
        // {
        //     System.Console.WriteLine(item.Id + " " + item.Name);
        // }

        requests = RequestStore.requests.Where(x => x.FirstFriend == account.Id).ToList();
        // requests.Where(x=>x.SecondFriend ==)
        Console.CursorVisible = false;
        ConsoleKeyInfo btn;
        // foreach (var item in requests)
        // {
        //     System.Console.WriteLine(item.FirstFriend + " " +  item.SecondFriend);
        // }
        int cnt = 0;

        while (btn.Key != ConsoleKey.Escape)
        {
            draw(cnt);

            switch (btn.Key)
            {
            case ConsoleKey.UpArrow:
                if (cnt > 0)
                {
                    cnt--;
                }
                break;

            case ConsoleKey.DownArrow:
                if (cnt < requests.Count - 1)
                {
                    cnt++;
                }
                break;

            case ConsoleKey.Enter:

                if (requests.Any())
                {
                    FriendshipStore.friendships.Add(requests[cnt]);
                    RequestStore.remove(requests.ElementAt(cnt));
                    requests.RemoveAt(cnt);
                }

                cnt = 0;
                break;
            }

            btn = Console.ReadKey();
        }

        // Console.WriteLine("Start");
        // foreach(var item in RequestStore.requests)
        // {
        //     Console.WriteLine(item.FirstFriend + " " + item.SecondFriend);
        // }
        // Console.WriteLine("Finish");

        RequestStore.SaveChanges();
        FriendshipStore.SaveChanges();
    }
Пример #11
0
 /// <summary>
 /// Creates a new instance of the CastleBind attribute. The name of the parameter will be used as the request prefix.
 /// </summary>
 /// <param name="requestStore">The requst store that should be used to bind the model</param>
 public CastleBindAttribute(RequestStore requestStore) : this(null, requestStore)
 {
 }
Пример #12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="requestStore">The requst store that should be used to bind the model</param>
 /// <param name="prefix">Prefix to use when extract </param>
 public CastleBindAttribute(string prefix, RequestStore requestStore) : base(prefix, requestStore)
 {
 }
Пример #13
0
 public Store GetSores(RequestStore requestStore)
 {
     return(storeService.Where(t => t.Brand == requestStore.Brand && !t.IsDeleted).FirstOrDefault());
 }
Пример #14
0
 public AbstractParameterBinderAttribute(string prefix, RequestStore requestStore)
 {
     _prefix       = prefix;
     _requestStore = requestStore;
 }
 public AbstractParameterBinderAttribute(string prefix, RequestStore requestStore)
 {
     _prefix = prefix;
     _requestStore = requestStore;
 }
Пример #16
0
 public DeserializeAttribute(string prefix, RequestStore requestStore)
     : base(prefix, requestStore)
 {
 }