Beispiel #1
0
        public async Task <List <Point> > GetRoute(int tripId)
        {
            var trip = await _tripRepository.GetById(tripId);

            var points = await _pointRepository.GetAll();

            var tripPoints = points.Where(p => p.Trip.Id == tripId);

            return(tripPoints.ToList());
        }
Beispiel #2
0
        static public void addPoint(Point Point)
        {
            using (PointRepository Pointrepo = new PointRepository())
            {
                List <Point> Pointtemp = null;

                Pointtemp = (List <Point>)Pointrepo.GetAll();
                //foreach (Point point in Pointtemp)
                //{
                //    Pointrepo.context.Entry(Point).State = EntityState.Detached;
                //}

                foreach (var item in Pointtemp)
                {
                    if (item.NumPoint >= Point.NumPoint)
                    {
                        item.NumPoint++;
                        //Pointrepo.Update(item);
                        Pointrepo.Save();
                    }
                }
                Pointrepo.Add(Point);
                Pointrepo.Save();
            }
        }
Beispiel #3
0
        public async Task <PointListTransactionResponse> Handle(PointListTransactionRequest request, CancellationToken cancellationToken)
        {
            var points = await PointRepository.GetAll(cancellationToken);

            PointListTransactionResponse response = new PointListTransactionResponse();

            response.PointList = points.Select(x => new Model.PointModel()
            {
                Id = x.Id, Name = x.Name
            }).ToList();
            return(response);
        }
Beispiel #4
0
        static public List <Point> GetAllPoints()
        {
            List <Point> Pointtemp = null;

            using (PointRepository Pointrepo = new PointRepository())
            {
                Pointtemp = (List <Point>)Pointrepo.GetAll();
                foreach (Point Point in Pointtemp)
                {
                    Pointrepo.context.Entry(Point).State = EntityState.Detached;
                }
            }

            return(Pointtemp);
        }
        public async Task <List <Point> > GetAllPoints(int id)
        {
            var points = await _pointRepository.GetAll();

            return(points.Where(p => p.Trip.Id == id).ToList());
        }