コード例 #1
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static Product GetItemByName(string name)
 {
     using (var context = new ContextApp())
     {
         return(context.Products.FirstOrDefault(x => x.Name == name));
     }
 }
コード例 #2
0
ファイル: AuthService.cs プロジェクト: slatysh/vshopedev
 public AuthService(ContextApp context, IMapper mapper, IScopeService scopeService, IEmailService emailService)
 {
     _context      = context;
     _mapper       = mapper;
     _emailService = emailService;
     _scopeService = scopeService;
 }
コード例 #3
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static string[] GetAllItems()
 {
     using (var context = new ContextApp())
     {
         return(context.Products.Select(x => x.Name).ToArray());
     }
 }
コード例 #4
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static Product GetItemById(int itemId)
 {
     using (var context = new ContextApp())
     {
         return(context.Products.FirstOrDefault(x => x.Id == itemId));
     }
 }
コード例 #5
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static Currency GetCurrencyById(int id)
 {
     using (var context = new ContextApp())
     {
         return(context.Currencies.FirstOrDefault(x => x.Id == id));
     }
 }
コード例 #6
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static Customer GetCustomerById(int id)
 {
     using (var context = new ContextApp())
     {
         return(context.Customers.FirstOrDefault(x => x.Id == id));
     }
 }
コード例 #7
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static string[] GetAllCurrency()
 {
     using (var context = new ContextApp())
     {
         return(context.Currencies.Select(x => x.Name).ToArray());
     }
 }
コード例 #8
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static string[] GetAllSellers()
 {
     using (var context = new ContextApp())
     {
         return(context.Sellers.Select(x => x.Name).ToArray());
     }
 }
コード例 #9
0
ファイル: CompanyService.cs プロジェクト: slatysh/vshopedev
 public CompanyService(ContextApp context, IMapper mapper, IAuthService authService, IVkService vkService)
 {
     _context     = context;
     _mapper      = mapper;
     _authService = authService;
     _vkService   = vkService;
 }
コード例 #10
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static Unit GetUnitById(int id)
 {
     using (var context = new ContextApp())
     {
         return(context.Units.FirstOrDefault(x => x.Id == id));
     }
 }
コード例 #11
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static void AddUnit(Unit Unit)
 {
     using (var context = new ContextApp())
     {
         context.Add(Unit);
         context.SaveChangesAsync();
     }
 }
コード例 #12
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static void AddCurrency(Currency currency)
 {
     using (var context = new ContextApp())
     {
         context.Add(currency);
         context.SaveChangesAsync();
     }
 }
コード例 #13
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static void AddSeller(Seller seller)
 {
     using (var context = new ContextApp())
     {
         context.Add(seller);
         context.SaveChangesAsync();
     }
 }
コード例 #14
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 public static void AddCustomer(Customer customer)
 {
     using (var context = new ContextApp())
     {
         context.Add(customer);
         context.SaveChangesAsync();
     }
 }
コード例 #15
0
 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;
 }
コード例 #16
0
        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);
            }
        }
コード例 #17
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
 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();
     }
 }
コード例 #18
0
ファイル: DbEditor.cs プロジェクト: nopills/Business-Helper
        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);
            }
        }
コード例 #19
0
        // 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);
        }
コード例 #20
0
 public CountryRepository(ContextApp pContext) : base(pContext)
 {
 }
コード例 #21
0
 public Repository(ContextApp context)
 {
     _context = context;
     _dbSet   = context.Set <T>();
 }
コード例 #22
0
 public PessoaRepository(ContextApp Context) : base(Context)
 {
     this._context = Context;
 }
コード例 #23
0
 public ClienteRepository(ContextApp context) : base(context)
 {
 }
コード例 #24
0

        
コード例 #25
0
 public EntityRepository(ContextApp pContext) : base(pContext)
 {
 }
コード例 #26
0
 public DictService(ContextApp context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
コード例 #27
0
 public UserRepository(ContextApp context) : base(context)
 {
 }
コード例 #28
0
 public ClienteController(ContextApp context)
 {
     this._context = context;
 }
コード例 #29
0

        
コード例 #30
0
 public AvitoXmlService(ContextApp context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }