Example #1
0
        public void UpdateAll(List <Position> positionsFetched)
        {
            var positions = _repository.GetAll();

            // Delete should be cascade if it's necessary
            // foreach (var position in positions)
            // {
            //     if (!positionsFetched.Select(v => v.Id).Contains(position.Id))
            //         _repository.Delete(position);
            // }
            foreach (var positionFetched in positionsFetched)
            {
                var foundPosition = positions.SingleOrDefault(v => v.Id == positionFetched.Id);
                if (foundPosition == null)
                {
                    _repository.Add(positionFetched);
                }
                else
                {
                    var name = positionFetched.Name.Trim();
                    if (foundPosition.Name != name)
                    {
                        foundPosition.Name = name;
                        _repository.Update(foundPosition);
                    }
                }
            }
        }
Example #2
0
 public IEnumerable <Position> GetAll()
 {
     return(_repository.GetAll());
 }
        public IEnumerable <Position> GetAll()
        {
            var res = _positionRepo.GetAll();;

            return(res);
        }
 public IEnumerable <Position> Positions()
 {
     return(_positionRepo.GetAll());
 }