public static void deleteRecord(string passed_name) { using (localdbChampionModel context = new localdbChampionModel()) { tblChampionMetaData champion = new tblChampionMetaData { name = passed_name }; var champtest = updatedb.searchDB(passed_name); context.tblChampionMetaDatas.Attach(champtest); context.tblChampionMetaDatas.Remove(champtest); context.SaveChanges(); } }
public static void editRecord(string name, int hp, int hpregen, int mana, int manaregen, int range, int ad, float attackspeed, int armour, int mr, int speed, int bluePrice, int rpPrice, string Q, string W, string E, string R, string passive, string imageLink) { using (localdbChampionModel db = new localdbChampionModel()) { tblChampionMetaData champion = new tblChampionMetaData { //name = inName, passive = inPassive, basead = inBasead //name = "Xayah", basead=64, passive="Clean Cuts" name = name.TrimEnd(), basehp = hp, hpregen = hpregen, basemana = mana, basemanaregen = manaregen, range = range, basead = ad, baseattackspeed = attackspeed, basearmour = armour, basemr = mr, basespeed = speed, bluePrice = bluePrice, rpPrice = rpPrice, Q = Q.TrimEnd(), W = W.TrimEnd(), E = E.TrimEnd(), R = R.TrimEnd(), passive = passive.TrimEnd(), imageLink = imageLink.TrimEnd() }; var original = db.tblChampionMetaDatas.Find(champion.name); if (original != null) { db.Entry(original).CurrentValues.SetValues(champion); var test = champion.passive; db.SaveChanges(); } } }
public static void pushDB(string name, int hp, int hpregen, int mana, int manaregen, int range, int ad, float attackspeed, int armour, int mr, int speed, int bluePrice, int rpPrice, string Q, string W, string E, string R, string passive, string imageLink) { using (localdbChampionModel context = new localdbChampionModel()) { tblChampionMetaData champion = new tblChampionMetaData { //name = "Xayah", basead=64, passive="Clean Cuts" //name = name, basehp = hp, hpregen = hpregen, basemana = mana, basemanaregen=manaregen, range = range, basead = ad, //baseattackspeed = attackspeed, basearmour = armour, basemr = mr, basespeed = speed, bluePrice = bluePrice, rpPrice = rpPrice, Q = Q, W = W, E = E, R = R, passive = passive, imageLink = imageLink name = name.Trim(), basehp = hp, hpregen = hpregen, basemana = mana, basemanaregen = manaregen, range = range, basead = ad, baseattackspeed = attackspeed, basearmour = armour, basemr = mr, basespeed = speed, bluePrice = bluePrice, rpPrice = rpPrice, Q = Q.Trim(), W = W.Trim(), E = E.Trim(), R = R.Trim(), passive = passive.Trim(), imageLink = imageLink.Trim() }; try { context.tblChampionMetaDatas.Add(champion); } catch { } context.SaveChanges(); } }