private void AddData() { string username = txtUsername.Text.Trim(); string emailTxt = txtEmail.Text.Trim(); string pass = txtPassword.Text.Trim(); string randompass = txtRandomCode.Text; SignUp signUp = new SignUp() { Username = txtUsername.Text.Trim(), Email = emailTxt, Password = pass, RandomCode = randompass, }; if (_context.Statuses.FirstOrDefault(x => x.StatusName == cmbStatus.Text) != null) { signUp.StatusId = _context.Statuses.FirstOrDefault(x => x.StatusName == cmbStatus.Text).Id; } else { MessageBox.Show("Status Secin Zehmet Olmasa"); return; } _context.SignUps.Add(signUp); _context.SaveChanges(); // MessageBox.Show("Ugurlu Qeydiyyat", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); // new SignInForum().Show(); this.Hide(); }
private void CheckInput() { if (string.IsNullOrEmpty(txtAge.Text) && string.IsNullOrEmpty(txtName.Text) && string.IsNullOrEmpty(TxtMebleg.Text) && string.IsNullOrEmpty(TxtSurname.Text)) { MessageBox.Show("Inputlari Bos Qoymayin", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CV cV = new CV() { Name = txtName.Text.Trim(), Surname = TxtSurname.Text.Trim(), Age = int.Parse(txtAge.Text), Tel_Number = txtNumber.Text, Min_Salary = Decimal.Parse(TxtMebleg.Text) }; if (_context.Categories.FirstOrDefault(x => x.Name == cmbCategory.Text) != null) { cV.CategoryId = _context.Categories.FirstOrDefault(x => x.Name == cmbCategory.Text).Id; } if (_context.Genders.FirstOrDefault(x => x.Gender1 == cmbGender.Text) != null) { cV.GenderId = _context.Genders.FirstOrDefault(x => x.Gender1 == cmbGender.Text).Id; } if (_context.Educations.FirstOrDefault(x => x.Name == cmbEdu.Text) != null) { cV.EducationId = _context.Educations.FirstOrDefault(x => x.Name == cmbEdu.Text).Id; } if (_context.Cities.FirstOrDefault(x => x.Name == cmbCity.Text) != null) { cV.CityId = _context.Cities.FirstOrDefault(x => x.Name == cmbCity.Text).Id; } if (_context.Experiences.FirstOrDefault(x => x.Experience1 == cmbTecrube.Text) != null) { cV.ExperienceId = _context.Experiences.FirstOrDefault(x => x.Experience1 == cmbTecrube.Text).Id; } _context.Cv.Add(cV); _context.SaveChanges(); }