Exemplo n.º 1
0
 public ExpensesStatisticsService(int userId, DateTime dateFrom, DateTime dateTo)
 {
     context       = new HomeBudgetContext();
     this.userId   = userId;
     this.dateFrom = dateFrom;
     this.dateTo   = dateTo;
 }
Exemplo n.º 2
0
        public Authentication(string userName, string password, string email)
        {
            _context = new HomeBudgetContext();

            _userName = userName;
            _password = password;
            _email    = email;
        }
Exemplo n.º 3
0
        public static bool AreCredentialsCorrect(string login, string password)
        {
            HomeBudgetContext context = new HomeBudgetContext();

            if (context.Users.Any(x => x.Login.Equals(login, StringComparison.OrdinalIgnoreCase) && x.Password.Equals(password, StringComparison.Ordinal)))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        public static bool Exist(string login)
        {
            HomeBudgetContext context = new HomeBudgetContext();

            if (context.Users.Any(x => x.Login.Equals(login, StringComparison.OrdinalIgnoreCase)))
            {
                return(true);
            }

            return(false);
        }
        public DbDataReadPermission(int userId, int?catId = null, int?unitId = null)
        {
            HomeBudgetContext context = new HomeBudgetContext();

            if (catId.HasValue && !context.Categories.Any(x => x.Id == catId.Value && (x.UserId == null || x.UserId == userId)))
            {
                HasPermission = false;
                ObjectNamesWithoutPermission.Add(nameof(Categories));
            }

            if (unitId.HasValue && !context.Units.Any(x => x.Id == unitId.Value))
            {
                HasPermission = false;
                ObjectNamesWithoutPermission.Add(nameof(Units));
            }
        }
Exemplo n.º 6
0
 public ExpensesService(int userId)
 {
     context     = new HomeBudgetContext();
     this.userId = userId;
 }
Exemplo n.º 7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, HomeBudgetContext context)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
                    HotModuleReplacement = true
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });

            HomeBudgetInitializer.Initialize(context);
        }
Exemplo n.º 8
0
 public UserInfo(string login)
 {
     User = new HomeBudgetContext().Users.First(x => x.Login == login);
 }
Exemplo n.º 9
0
 public UnitsService()
 {
     context = new HomeBudgetContext();
 }
Exemplo n.º 10
0
 public CategoryController(HomeBudgetContext hbContext)
 {
     _context = hbContext;
 }
Exemplo n.º 11
0
 public CategoriesService(int userId)
 {
     context     = new HomeBudgetContext();
     this.userId = userId;
 }
Exemplo n.º 12
0
 public RealizationController(HomeBudgetContext hbContext)
 {
     _context = hbContext;
 }
Exemplo n.º 13
0
 public PlanController(HomeBudgetContext hbContext)
 {
     _context = hbContext;
 }
Exemplo n.º 14
0
 public Searcher(string text, int maxResultCount)
 {
     this.text           = text;
     this.maxResultCount = maxResultCount;
     context             = new HomeBudgetContext();
 }
 public CentralTendencyExpense(string name, int userId)
 {
     context     = new HomeBudgetContext();
     this.name   = name;
     this.userId = userId;
 }
Exemplo n.º 16
0
 public AddingExpenseService()
 {
     context = new HomeBudgetContext();
 }
Exemplo n.º 17
0
 public ExpenseService(int expenseId, int userId)
 {
     this.userId = userId;
     context     = new HomeBudgetContext();
     Expense     = context.Expenses.Include(x => x.Category).Include(x => x.Unit).FirstOrDefault(x => x.Id == expenseId && x.UserId == userId);
 }