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); }
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(); }
public virtual Device GetDevice(int id) { return(_deviceRepo.GetByID(id)); }