// sets parameters for insert/update private Dictionary<string, object> SetParams(Team data) { Dictionary<string, object> result = new Dictionary<string, object>(); result.Add("@name", data.Name); return result; }
public ActionResult Edit(int id, Team collection) { try { // TODO: Add update logic here db.Update(collection, id); return RedirectToAction("Index"); } catch { return View(collection); } }
public ActionResult Create(Team collection) { try { // TODO: Add insert logic here db.Insert(collection); return RedirectToAction("Index"); } catch { return View(); } }
public void Update(Team data, int id) { ExecuteNonQuery(QueryBuilder.Update(_tableName, TargetFields, id, _pkField), SetParams(data)); }
public void Insert(Team data) { ExecuteNonQuery(QueryBuilder.Insert(_tableName, TargetFields), SetParams(data)); }