public FacturaController(DbaContext context) { List <FacturaDetalle> fDetalles = new List <FacturaDetalle>(); fDetalles.Add(new FacturaDetalle { FacturaDetalleId = "FD1", Producto = (new Producto { Id = "P2", Marca = "MNAN", Categoria = "Automovil", Size = "19'", Stock = 50, PrecioCompra = 125000, PrecioVenta = 15000 }), Precio = 123009 }); _context = context; if (_context.Facturas.Count() == 0) { // Crea un nuevo item si la coleccion esta vacia, // lo que significa que no puedes borrar todos los Items. _context.Facturas.Add(new Factura { FacturaId = "F1", Fecha = DateTime.Now , Cliente = (new Cliente { Id = "1010", Nombres = "Kevin", Apellidos = "Martinez", Telefono = "30029281", Direccion = "MZG casa" }) , Detalles = fDetalles , TotalCompra = 154400 }); _context.SaveChanges(); } }
public static DbaContext GetDBAContext() { DbContextOptions <DbaContext> options; var builder = new DbContextOptionsBuilder <DbaContext>(); builder.UseInMemoryDatabase("test"); options = builder.Options; DbaContext dbaContext = new DbaContext(options); dbaContext.Database.EnsureDeleted(); dbaContext.Database.EnsureCreated(); return(dbaContext); }
public void Setup() { _dbaContext = InMemoryDBAProvider.GetDBAContext(); _eventList = new List <Model.Event> { new Model.Event() { Id = 1, Description = "Description 1", Title = "Title 1", Message = "Message 1", Date = DateTime.Now.AddDays(1), }, new Model.Event() { Id = 2, Description = "Description 2", Title = "Title 2", Message = "Message 2", Date = DateTime.Now.AddDays(2), }, new Model.Event() { Id = 3, Description = "Description 3", Title = "Title 3", Message = "Message 3", Date = DateTime.Now.AddDays(3), }, new Model.Event() { Id = 4, Description = "Description 4", Title = "Title 4", Message = "Message 4", Date = DateTime.Now.AddDays(4), }, }; foreach (var ev in _eventList) { _dbaContext.Events.Add(ev); } _dbaContext.SaveChanges(); _instance = new Repository <Model.Event>(_dbaContext); }
public ClienteController(DbaContext context) { _context = context; if (_context.Clientes.Count() == 0) { // Crea un nuevo item si la coleccion esta vacia, // lo que significa que no puedes borrar todos los Items. _context.Clientes.Add(new Cliente { Id = "1065853", Nombres = "Kevin", Apellidos = "Martinez" , Telefono = "3003049457" , Direccion = "Mz g csa10" } ); _context.SaveChanges(); } }
public ProductoController(DbaContext context) { _context = context; if (_context.Productos.Count() == 0) { // Crea un nuevo item si la coleccion esta vacia, // lo que significa que no puedes borrar todos los Items. _context.Productos.Add(new Producto { Id = "P1", Marca = "Muchs", Categoria = "Automovil" , Size = "18'" , Stock = 50 , PrecioCompra = 25000 , PrecioVenta = 35000 } ); _context.SaveChanges(); } }
public IActionRepository CreateRepository(DbaContext dbContext) { return(new ActionRepository(dbContext)); }
public AccountController(DbaContext context) { _context = context; }
public IEventRepository CreateRepository(DbaContext dbContext) { return(new EventRepository(dbContext)); }
public ActionRepository(DbaContext dbaContext) : base(dbaContext) { }
public Repository(DbaContext dbContext) { _dbContext = dbContext; }
public RepositoryBase() { _context = new DbaContext(); _dbSet = _context.Set <TEntity>(); }
public Financial_TransactionController(DbaContext context) { _context = context; }
public void Setup() { _dbaContext = InMemoryDBAProvider.GetDBAContext(); _eventRepositoryProvider = new Mock <IEventRepositoryProvider>(); _actionRepositoryProvider = new Mock <IActionRepositoryProvider>(); #region Events _eventList = new List <Model.Event> { new Model.Event() { Id = 1, Description = "Description 1", Title = "Title 1", Message = "Message 1", Date = DateTime.Now.AddDays(1), }, new Model.Event() { Id = 2, Description = "Description 2", Title = "Title 2", Message = "Message 2", Date = DateTime.Now.AddDays(2), }, new Model.Event() { Id = 3, Description = "Description 3", Title = "Title 3", Message = "Message 3", Date = DateTime.Now.AddDays(3), }, new Model.Event() { Id = 4, Description = "Description 4", Title = "Title 4", Message = "Message 4", Date = DateTime.Now.AddDays(4), }, }; foreach (var ev in _eventList) { _dbaContext.Events.Add(ev); } #endregion #region ActionKinds _actiontKindList = new List <Model.ActionKind> { new Model.ActionKind() { Id = 1, Description = "Action Kind 1", }, new Model.ActionKind() { Id = 2, Description = "Action Kind 2", }, }; foreach (var ak in _actiontKindList) { _dbaContext.ActionKinds.Add(ak); } #endregion #region Subscriptions _subscriptionList = new List <Model.Subscription> { new Model.Subscription() { Id = 1, }, new Model.Subscription() { Id = 2, }, }; foreach (var s in _subscriptionList) { _dbaContext.Subscriptions.Add(s); } #endregion #region Actions _actiontList = new List <Model.Action> { new Model.Action() { Id = 1, Date = DateTime.Now.AddDays(1), Kind = _actiontKindList.First(), Subscription = _subscriptionList.First(), }, new Model.Action() { Id = 2, Date = DateTime.Now.AddDays(2), Kind = _actiontKindList.First(), }, new Model.Action() { Id = 3, Date = DateTime.Now.AddDays(3), Subscription = _subscriptionList.First(), }, new Model.Action() { Id = 4, Date = DateTime.Now.AddDays(4), }, }; foreach (var a in _actiontList) { _dbaContext.Actions.Add(a); } #endregion _dbaContext.SaveChanges(); _eventRepositoryProvider.Setup(x => x.CreateRepository(_dbaContext)).Returns(new EventRepository(_dbaContext)); _actionRepositoryProvider.Setup(x => x.CreateRepository(_dbaContext)).Returns(new ActionRepository(_dbaContext)); _instance = new UnitOfWork(_dbaContext, _eventRepositoryProvider.Object, _actionRepositoryProvider.Object); }
public AspNetUsersController(DbaContext context) { _context = context; }
public Customer_InfoController(DbaContext context) { _context = context; }
public NotificationController(DbaContext context) { _context = context; }
public EventRepository(DbaContext dbaContext) : base(dbaContext) { }
internal RepositoryBase(DbaContext context) { _context = context; _dbSet = context.Set <TEntity>(); }
public Customer_AccountController(DbaContext context) { _context = context; }