protected void GetSoftware(string id) { string strSQL = "SELECT * FROM Software WHERE ID = @SoftwareID"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@SoftwareID", id) }; SqlDataReader dr = DAL.SQLHelper.GetReader(strSQL, paras); dr.Read(); if (dr.HasRows) { SoftwareName = dr.GetValue(1).ToString(); SoftwareIcon = dr.GetValue(2).ToString(); SoftwareEdition = dr.GetValue(3).ToString(); SoftwareLanguage = dr.GetValue(4).ToString(); SoftwareRunningEnvironment = dr.GetValue(5).ToString(); SoftwareAuthorizationWay = dr.GetValue(6).ToString(); SoftwareSize = dr.GetValue(7).ToString(); SoftwareScreenShots = dr.GetValue(8).ToString(); SoftwareOfficialWebsite = dr.GetValue(9).ToString(); SoftwareDownloadWebsite = dr.GetValue(10).ToString(); SoftwareState = dr.GetValue(11).ToString(); this.SoftwareNameTextBox.Text = SoftwareName; this.SoftwareEditionTextBox.Text = SoftwareEdition; this.SoftwareOfficialWebsiteTextBox.Text = SoftwareOfficialWebsite; this.SoftwareDownloadWebsiteTextBox.Text = SoftwareDownloadWebsite; for (int i = 0; i < this.SoftwareLanguageDropDownList.Items.Count; i++) { if (SoftwareLanguage.Equals(this.SoftwareLanguageDropDownList.Items[i].Value)) { this.SoftwareLanguageDropDownList.Items[i].Selected = true; } } SetChecked(this.SoftwareRunningEnvironmentCheckBoxList, SoftwareRunningEnvironment, ","); for (int i = 0; i < this.SoftwareAuthorizationWayDropDownList.Items.Count; i++) { if (SoftwareAuthorizationWay.Equals(this.SoftwareAuthorizationWayDropDownList.Items[i].Value)) { this.SoftwareAuthorizationWayDropDownList.Items[i].Selected = true; } } this.SoftwareSizeTextBox.Text = SoftwareSize; for (int i = 0; i < this.SoftwareStateRadioButtonList.Items.Count; i++) { if (this.SoftwareState.Equals(this.SoftwareStateRadioButtonList.Items[i].Value)) { this.SoftwareStateRadioButtonList.Items[i].Selected = true; } } } }
public async Task <ActionResult> Create(SoftwareLanguage softwareLanguage) { try { var software = new SoftwareLanguage { Name = softwareLanguage.Name }; _context.SoftwareLanguages.Add(software); //Save changes to the databse await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
// GET: SoftwareLanguages/Create public async Task <ActionResult> Create() { var softwareLanguage = new SoftwareLanguage(); return(View(softwareLanguage)); }