/// <summary> /// insert Control /// </summary> /// <param name="control"></param> /// <param name="current"></param> /// <returns></returns> public override Control registrarControl(Control control, Current current) { using (var scope = _serviceScopeFactory.CreateScope()){ FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); fc.Controles.Add(control); fc.SaveChanges(); return(control); } }
/// <summary> /// insert ficha /// </summary> /// <param name="ficha"></param> /// <param name="current"></param> /// <returns></returns> public override Ficha registrarFicha(Ficha ficha, Current current) { using (var scope = _serviceScopeFactory.CreateScope()){ FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); fc.Fichas.Add(ficha); fc.SaveChanges(); return(ficha); } }
/// <summary> /// insert Persona /// </summary> /// <param name="persona"></param> /// <param name="current"></param> /// <returns></returns> public override Persona registrarPersona(Persona persona, Current current) { using (var scope = _serviceScopeFactory.CreateScope()){ FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); fc.Personas.Add(persona); fc.SaveChanges(); return(persona); } }
/// <summary> /// Get Ficha by number /// </summary> /// <param name="numero"></param> /// <param name="current"></param> /// <returns></returns> public override Ficha obtenerFicha(int numero, Current current) { using (var scope = _serviceScopeFactory.CreateScope()){ FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); Ficha ficha = fc.Fichas.Find(numero); fc.SaveChanges(); return(ficha); } }
/// <summary> /// insert Foto /// </summary> /// <param name="foto"></param> /// <param name="current"></param> /// <returns></returns> public override Foto agregarFoto(Foto foto, Current current) { using (var scope = _serviceScopeFactory.CreateScope()){ FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); fc.Fotos.Add(foto); fc.SaveChanges(); return(foto); } }
/// <summary> /// Get The Persona. /// </summary> /// <param name="numero">to save</param> /// <param name="current">the context of ZeroIce</param> /// <returns></returns> public override Persona obtenerPersona(string rut, Current current = null) { using (var scope = _serviceScopeFactory.CreateScope()){ FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); Persona persona = fc.Personas.Find(rut); fc.SaveChanges(); return(persona); } }
public override bool registrarDuenio(Persona persona, Current current = null) { // Using the local scope using (var scope = _serviceScopeFactory.CreateScope()) { FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); fc.Personas.Add(persona); fc.SaveChanges(); return(true); } }
/// <summary> /// Constructor /// </summary> /// <param name="logger"></param> /// <param name="serviceScopeFactory"></param> public ContratosImpl(ILogger <ContratosImpl> logger, IServiceScopeFactory serviceScopeFactory) { _logger = logger; _logger.LogDebug("Building ContratosIMPL"); _serviceScopeFactory = serviceScopeFactory; //Creating db _logger.LogInformation("Creating the Database..."); using (var scope = _serviceScopeFactory.CreateScope()) { FivetContext fc = scope.ServiceProvider.GetService <FivetContext>(); fc.Database.EnsureCreated(); fc.SaveChanges(); } _logger.LogInformation("Done!!"); }