Beispiel #1
0
        private void btSaveType_Click(object sender, EventArgs e)
        {
            if (txtNameType.Text == string.Empty)
            {
                txtNameType.Focus();
                errorProviderName.SetError(txtNameType, "Can't be empty");
            }
            else if (txtCodeType.Text == string.Empty)
            {
                txtCodeType.Focus();
                errorProviderCode.SetError(txtCodeType, "Can't be empty");
            }
            if (txtNameType.Text != string.Empty && txtCodeType.Text != string.Empty)

            {
                int countType;
                List <ConferenceTypeModel> listConferanceType = conferanceTypeRepository.getAllTypes();
                countType = listConferanceType.Count;
                ConferenceTypeModel type;
                for (int i = 0; i < countType; i++)
                {
                    type = listConferanceType.ElementAt(i);


                    if (ConferanceTypeId != null && ConferanceTypeId == i + 1)
                    {
                        type.ConferenceTypeName = txtNameType.Text;
                        type.ConferenceTypeCode = txtCodeType.Text;

                        conferanceTypeRepository.getType(type);
                    }
                    else
                    {
                        ConferenceTypeModel typeNew = new ConferenceTypeModel();
                        if (ConferanceTypeId == null)
                        {
                            typeNew.ConferenceTypeCode = " ";
                            typeNew.ConferenceTypeName = " ";
                            ConferanceTypeId           = 0;
                            typeNew.ConferenceTypeName = txtNameType.Text;
                            typeNew.ConferenceTypeCode = txtCodeType.Text;

                            conferanceTypeRepository.insertType(typeNew);
                        }
                    }
                }
                this.Close();
            }
        }
Beispiel #2
0
        public IActionResult GetDemo()
        {
            List <ConferenceTypeModel> typeModels = conferenceType.getAllTypes();

            return(Ok(typeModels));
        }