Exemplo n.º 1
0
        public static List <ConnectionsModel> ConvertToConnections(this List <string> lines, List <PersonModel> people)
        {
            List <ConnectionsModel> output = new List <ConnectionsModel>();

            foreach (string line in lines)
            {
                string[] cols = line.Split('#');

                ConnectionsModel c = new ConnectionsModel();
                PersonModel      p = new PersonModel();


                c.Id = int.Parse(cols[0]);
                int firstId  = int.Parse(cols[1]);
                int secondId = int.Parse(cols[2]);


                foreach (PersonModel person in people)
                {
                    if (person.Id == firstId)
                    {
                        c.FirstConnectedPerson = person;
                    }
                    if (person.Id == secondId)
                    {
                        c.SecondPersonModel = person;
                    }
                }

                output.Add(c);
            }

            return(output);
        }
Exemplo n.º 2
0
        public IActionResult Connections([FromServices] ConnectionsManager manager)
        {
            ConnectionsModel     model           = new ConnectionsModel();
            ICollection <string> openConnections = manager.GetConnections();

            foreach (var connection in openConnections)
            {
                model.activeConnections.Add(new BinanceConnectionModel {
                    Symbol = connection
                });
            }

            return(View(model));
        }
Exemplo n.º 3
0
        public ResponseModel RespondToConnectionRequest(ConnectionsModel request)
        {
            IMasterTablesDataAccess _repository = new MasterTablesDataAccess();
            int response = 0;

            response = _repository.UpdateConnectionRequest(request);
            string        Status = "0";
            ResponseModel model  = new ResponseModel();

            if (response > 0)
            {
                model.Status  = response.ToString();
                model.Message = "";
            }
            else
            {
                model.Status = "0";
            }
            return(model);
        }