예제 #1
0
        private List <T> GiveObjects <T>(IEnumerable <int> selectedIds, IGenericRepo <T> repo) where T : class
        {
            List <T> objects = new List <T>();

            foreach (int id in selectedIds)
            {
                objects.Add(repo.GetByID(id));
            }

            return(objects);
        }
예제 #2
0
        public void Order(int deviceId, int quantity, string userId)
        {
            Device device = _deviceRepo.GetByID(deviceId);

            _orderRepo.Insert(new Order()
            {
                Device   = device,
                UserID   = userId,
                Quantity = quantity
            });

            _orderRepo.SetEntityState(device, EntityState.Unchanged);
            _orderRepo.SaveChanges();
        }
예제 #3
0
 public virtual Device GetDevice(int id)
 {
     return(_deviceRepo.GetByID(id));
 }