예제 #1
0
        private void WithdrawBtnClick(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(sumTB.Text))
            {
                MessageBox.Show("Пустое поле!");
                return;
            }
            if (!double.TryParse(sumTB.Text, out var sum))
            {
                MessageBox.Show("Неправильно введено число");
                return;
            }
            if (sum > account.Balance)
            {
                MessageBox.Show("Не хватает денег!");
                return;
            }
            using (var context = new BankSystemContext())
            {
                account.Balance -= sum;
                context.SaveChanges();
            }
            var message = $"Вам на счет поступило {sum} тенге";

            action.BeginInvoke(account.MobileNumber, message, ProcessResult, null);
        }
예제 #2
0
파일: Startup.cs 프로젝트: anhzin/exam
        // 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, BankSystemContext context)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

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

            DbInitializer.Initialize(context);
        }