public async Task <IEnumerable <Marca> > GetAll() { using (_context = new PhonesContext()) { return(await _context.Marcas.ToListAsync()); } }
public async Task <IEnumerable <Phone> > GetAll() { using (_context = new PhonesContext()) { return(await _context.Phones.Include(p => p.Modelo).ToListAsync()); } }
public async Task <IEnumerable <RepairOrder> > GetAll() { using (_context = new PhonesContext()) { return(await _context.RepairOrders.Include(rp => rp.Cliente).Include(rp => rp.Phone.Modelo).ToListAsync()); } }
public async Task <RepairOrder> FindOneById(int id) { using (_context = new PhonesContext()) { return(await(from rp in _context.RepairOrders.Include(rp => rp.Cliente).Include(rp => rp.Phone.Modelo.Marca) where rp.Id == id select rp).SingleOrDefaultAsync()); } }
public async Task Delete(Phone entity) { using (_context = new PhonesContext()) { _context.Entry(entity).State = EntityState.Deleted; await _context.SaveChangesAsync(); } }
public async Task <IEnumerable <Modelo> > GetAll() { using (_context = new PhonesContext()) { // Recupero todos los modelos con el objeto marca relacionado // return(await _context.Modelos.Include(m => m.Marca).ToListAsync()); } }
public async Task Delete(Modelo model) { using (_context = new PhonesContext()) { model = _context.Modelos.Find(model.Id); _context.Entry(model).State = EntityState.Deleted; await _context.SaveChangesAsync(); } }
public async Task Update(Modelo model) { using (_context = new PhonesContext()) { _context.Entry(model).State = EntityState.Modified; _context.Entry(model.Marca).State = EntityState.Unchanged; await _context.SaveChangesAsync(); } }
public async Task Update(Phone entity) { using (_context = new PhonesContext()) { _context.Entry(entity.Modelo).State = EntityState.Modified; _context.Entry(entity).State = EntityState.Modified; await _context.SaveChangesAsync(); } }
public async Task Update(RepairOrder entity) { using (_context = new PhonesContext()) { _context.Entry(entity.Phone).State = EntityState.Modified; _context.Entry(entity.Cliente).State = EntityState.Modified; _context.Entry(entity).State = EntityState.Modified; await _context.SaveChangesAsync(); } }
public MainViewModel() { Db = new PhonesContext(); Db.Phones.Load(); Phones = Db.Phones.Local; WinState = PackIconKind.WindowMaximize; ListStyles = new List <string>(); ListStyles.Add("Dark"); ListStyles.Add("Light"); SelectedStyle = ListStyles[0]; Languages = new List <string>(); Languages.Add("Русский"); Languages.Add("English"); Languages.Add("Українська"); SelectedLanguage = Languages[0]; }
public PhonesController(PhonesContext context) { db = context; if (!db.Phones.Any()) { db.Phones.Add(new Phones { Name = "Huawei p20 pro", Brend = "Huawei", Price = 1290.00m }); db.Phones.Add(new Phones { Name = "Iphone 7", Brend = "Apple inc.", Price = 990.00m }); db.Phones.Add(new Phones { Name = "Xiaomi Redmi 5", Brend = "Xiaomi", Price = 349.00m }); db.SaveChanges(); } }
public ReservationRepository(PhonesContext context) { _context = context; }
public GenericRepository(PhonesContext context) { _context = context; }
public PhonesController(PhonesContext context) { _context = context; }
public OrderRepository(PhonesContext context) { _context = context; }
public PhoneRepository(PhonesContext context) { _context = context; }