public static Product GetItemByName(string name) { using (var context = new ContextApp()) { return(context.Products.FirstOrDefault(x => x.Name == name)); } }
public AuthService(ContextApp context, IMapper mapper, IScopeService scopeService, IEmailService emailService) { _context = context; _mapper = mapper; _emailService = emailService; _scopeService = scopeService; }
public static string[] GetAllItems() { using (var context = new ContextApp()) { return(context.Products.Select(x => x.Name).ToArray()); } }
public static Product GetItemById(int itemId) { using (var context = new ContextApp()) { return(context.Products.FirstOrDefault(x => x.Id == itemId)); } }
public static Currency GetCurrencyById(int id) { using (var context = new ContextApp()) { return(context.Currencies.FirstOrDefault(x => x.Id == id)); } }
public static Customer GetCustomerById(int id) { using (var context = new ContextApp()) { return(context.Customers.FirstOrDefault(x => x.Id == id)); } }
public static string[] GetAllCurrency() { using (var context = new ContextApp()) { return(context.Currencies.Select(x => x.Name).ToArray()); } }
public static string[] GetAllSellers() { using (var context = new ContextApp()) { return(context.Sellers.Select(x => x.Name).ToArray()); } }
public CompanyService(ContextApp context, IMapper mapper, IAuthService authService, IVkService vkService) { _context = context; _mapper = mapper; _authService = authService; _vkService = vkService; }
public static Unit GetUnitById(int id) { using (var context = new ContextApp()) { return(context.Units.FirstOrDefault(x => x.Id == id)); } }
public static void AddUnit(Unit Unit) { using (var context = new ContextApp()) { context.Add(Unit); context.SaveChangesAsync(); } }
public static void AddCurrency(Currency currency) { using (var context = new ContextApp()) { context.Add(currency); context.SaveChangesAsync(); } }
public static void AddSeller(Seller seller) { using (var context = new ContextApp()) { context.Add(seller); context.SaveChangesAsync(); } }
public static void AddCustomer(Customer customer) { using (var context = new ContextApp()) { context.Add(customer); context.SaveChangesAsync(); } }
public VkService(IConfiguration conf, ContextApp context, ILogger <VkService> logger, IMapper mapper, IWebRequestService webRequestService) { _context = context; _mapper = mapper; _logger = logger; _conf = conf; _vkApi = new VkApi(); _webRequestService = webRequestService; }
public void CadastrarColaboradorTeste() { using (var db = new ContextApp()) { var repositorio = new ColaboradorRepositorioEF(db); var negocio = new ColaboradorNegocio(repositorio); var colaborador = Colaborador.CriarColaborador("amanda.avelino.lopes", 131095, "Amanda Avelino Lopes"); negocio.CadastrarColaborador(colaborador); } }
public static void AddItem(string Name, double Price, double VAT, string UnitName, string UnitCode) { using (var context = new ContextApp()) { context.Add( new Product { Name = Name, Price = Price, VAT = VAT, UnitName = UnitName, UnitCode = UnitCode }); context.SaveChangesAsync(); } }
public static (double, double, string, string) GetItem(string Name) { double Price = default; double VAT = default; string UnitName = String.Empty; string UnitCode = String.Empty; using (var context = new ContextApp()) { var res = context.Products.Where(x => x.Name == Name).Select(y => new { prc = y.Price, untcode = y.UnitCode, unt = y.UnitName, vat = y.VAT }); foreach (var a in res) { Price = a.prc; VAT = a.vat; UnitName = a.unt; UnitCode = a.untcode; } return(Price, VAT, UnitName, UnitCode); } }
// IMyScopedService is injected into Invoke public async Task Invoke(HttpContext httpContext, ContextApp context) { // recupera a Claim de Usuário var userId = httpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (userId != null && !string.IsNullOrEmpty(userId.Value)) { context.IsAutenticated = true; context.UserId = Convert.ToInt32(userId.Value); } var clientId = httpContext.User.FindFirst(ContextApp.ClaimCliente); if (clientId != null && !string.IsNullOrEmpty(clientId.Value)) { context.ClientId = Convert.ToInt32(clientId.Value); } await _next(httpContext); }
public CountryRepository(ContextApp pContext) : base(pContext) { }
public Repository(ContextApp context) { _context = context; _dbSet = context.Set <T>(); }
public PessoaRepository(ContextApp Context) : base(Context) { this._context = Context; }
public ClienteRepository(ContextApp context) : base(context) { }
public EntityRepository(ContextApp pContext) : base(pContext) { }
public DictService(ContextApp context, IMapper mapper) { _context = context; _mapper = mapper; }
public UserRepository(ContextApp context) : base(context) { }
public ClienteController(ContextApp context) { this._context = context; }
public AvitoXmlService(ContextApp context, IMapper mapper) { _context = context; _mapper = mapper; }