Beispiel #1
0
        public async Task <IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                Pokupatel user = new Pokupatel {
                    Email = model.Email, UserName = model.Email, Fio = model.Fio, IdCard = int.Parse(model.ID_Card),
                };
                // добавляем пользователя
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    // установка куки
                    await _signInManager.SignInAsync(user, false);

                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError(string.Empty, error.Description);
                    }
                }
            }
            return(View(model));
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Pokupatel pokupatel = new Pokupatel();

            pokupatel.pokupatelSurname  = "Ромащенко";
            pokupatel.pokupatelName     = "Анна";
            pokupatel.pokupatelPatronim = "Владимировна";
            pokupatel.pokupatelAdress   = "Г Екатеринбург, Ул. Мичурина 11";
            pokupatel.cardGet("2200 2200 1300 1400");
            pokupatel.bankGet("187");
            pokupatel.outText();
            Console.ReadLine();
        }
Beispiel #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "")
         {
             MessageBox.Show("Введите данные");
             return;
         }
         Pokupatel p = new Pokupatel();
         p.FullName = textBox1.Text;
         p.Address  = textBox2.Text;
         p.Phone    = textBox3.Text;
         db.Pokupatel.Add(p);
         db.SaveChanges();
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
         this.Close();
     }
 }