public void UpdateCategory(WeaponCategoryDTO weaponCategory) { string query = "UPDATE dbo.WeaponCategory SET WeaponCategoryName = @WeaponCategoryName Where WeaponCategoryID = @WeaponCategoryId"; using (SqlConnection conn = new SqlConnection(connenctionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(query, conn)) { command.Parameters.AddWithValue("@WeaponCategoryId", weaponCategory.WeaponCategoryId); command.Parameters.AddWithValue("@WeaponCategoryName", weaponCategory.WeaponCategoryName); command.ExecuteNonQuery(); conn.Close(); } } }
public WeaponCategoryDTO GetWeaponCategoryName(string name) { WeaponCategoryDTO weaponCategory = null; using (SqlConnection conn = new SqlConnection(connenctionString)) { conn.Open(); using (SqlCommand command = new SqlCommand("SELECT * FROM WeaponCategory Where WeaponCategoryName = @WeaponCategoryName", conn)) { command.Parameters.AddWithValue("@WeaponCategoryName", name); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { weaponCategory = new WeaponCategoryDTO(reader.GetInt32(0), reader.GetString(1)); } } conn.Close(); } } return(weaponCategory); }
public void AddWeaponCategoryDTO(WeaponCategoryDTO weaponCategory) { this.WeaponCategories.Add(weaponCategory); }
public void CreateExtraWeaponCategroyWargear(WargearDTO wargearDto, WeaponCategoryDTO WeaponCategoryDto) { IwargearContext.CreateWargearFactionWeaponCategory(wargearDto.WargearName, wargearDto.FactionBelongTo, WeaponCategoryDto); }
public void UpdateWargearWeaponCategory(WargearDTO wargear, WeaponCategoryDTO waCategoryDto) { wargearRepository.CreateExtraWeaponCategroyWargear(wargear, waCategoryDto); }
public WeaponCategoryModel(WeaponCategoryDTO weaponCategoryDto) { WeaponCategoryId = weaponCategoryDto.WeaponCategoryId; WeaponCategoryName = weaponCategoryDto.WeaponCategoryName; }
public WeaponCategoryLogic(WeaponCategoryDTO weaponCategoryDto) { this.WeaponCategoryId = weaponCategoryDto.WeaponCategoryId; this.WeaponCategoryName = weaponCategoryDto.WeaponCategoryName; }
public void CreateWargearFactionWeaponCategory(string wargearName, FactionDTO faction, WeaponCategoryDTO weaponCategory) { using (SqlConnection conn = new SqlConnection(connenctionString)) { conn.Open(); using (SqlCommand command = new SqlCommand( "INSERT INTO dbo.Wargear_Faction_WeaponCategory(WargearFactionID, WeaponCatagoryID) VALUES((select WargearFactionID From Wargear_Faction Where WargearID = (select WargearID FROM Wargear Where WargearName = @WargearName) and FactionID = @FactionID), @WeaponCategoryID )", conn)) { command.Parameters.AddWithValue("@WargearName", wargearName); command.Parameters.AddWithValue("@FactionID", faction.FactionId); command.Parameters.AddWithValue("@WeaponCategoryID", weaponCategory.WeaponCategoryId); command.ExecuteNonQuery(); conn.Close(); } } }
public void UpdateCategory(WeaponCategoryDTO wargearCategory) { weaponCategoryContext.UpdateCategory(wargearCategory); }