コード例 #1
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();
            }
        }
コード例 #2
0
        public IActionResult SendSelected([Bind("Employees, AllocationValue")] EmployeeSelectionViewModel model, int AdminId)
        {
            var selectedIds = model.Employees.Where(m => m.IsSelected).Select(m => m.Id);
            var points      = employeeRepository.GetAll().Where(e => selectedIds.Contains(e.Id))
                              .Select(e =>
                                      new Point
            {
                Employee     = e,
                Value        = model.AllocationValue,
                IsAward      = false,
                Timestamp    = DateTime.Now,
                ReceivedFrom = employeeRepository.GetById(AdminId)
            });

            points.ToList().ForEach(p => pointRepository.Add(p));
            pointRepository.Save();
            return(RedirectToAction(nameof(Index)));
        }
コード例 #3
0
 private void ReadSamplePoints(PointRepository <XyzPoint> repository)
 {
     repository.Add(new XyzPoint()
     {
         Id = "A", X = 1, Y = 5, Z = 1.1
     });
     repository.Add(new XyzPoint()
     {
         Id = "B", X = 8, Y = 2, Z = 2.22
     });
     repository.Add(new XyzPoint()
     {
         Id = "C", X = 2, Y = 9, Z = 3.333
     });
     repository.Add(new XyzPoint()
     {
         Id = "D", X = 8, Y = 4, Z = 4.4444
     });
 }
コード例 #4
0
        private PointRepository <XyzPoint> GetPoints()
        {
            var points = new PointRepository <XyzPoint>();

            foreach (var bl in _blockRefs)
            {
                points.Add(ToPoint(bl));
            }
            return(points);
        }
コード例 #5
0
        public async Task <IActionResult> AddPoint(int tripId, Point point)
        {
            if (!(await _tripRepository.Exists(tripId)))
            {
                return(NotFound());
            }

            var trip = await _tripRepository.GetById(tripId);

            point.Trip = trip;
            var newPoint = await _pointRepository.Add(point);

            return(Ok(newPoint));
        }
コード例 #6
0
        public async Task <PointUpdateTransactionResponse> Handle(PointCreateTransactionRequest request, CancellationToken cancellationToken)
        {
            var point = await PointRepository.Add(new Infrastructure.Persistence.DTO.Point()
            {
                Name = request.Name
            }, cancellationToken);

            PointUpdateTransactionResponse response = new PointUpdateTransactionResponse();

            response.Point = new Model.PointModel()
            {
                Id = point.Id, Name = point.Name
            };
            return(response);
        }