public void SetGender(Entity.Gender gender) { this.gender = gender; mediaTypes = (new MediaTypeRepository()).FindAll(); genders = (new GenderRepository()).FindAll(); statuses = (new StatusRepository()).FindAll(); }
private void btnAccept_Click(object sender, EventArgs e) { try { Entity.Gender gender = new Entity.Gender { Name = NativeRules.CheckString(txtName.Text.ToString().Trim(), "Nombre inválido", 5, 50), MediaType = (new MediaTypeRepository()).FindById(int.Parse(comboMediaType.SelectedValue.ToString())), ParentGender = (new GenderRepository()).FindById(int.Parse(comboParentGender.SelectedValue.ToString())) }; (new GenderRepository()).Add(gender); MessageBox.Show("El género se ha creado exitosamente!"); this.btnBack_Click(sender, e); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }