// sets parameters for insert/update
        private Dictionary<string, object> SetParams(Billability data)
        {
            Dictionary<string, object> result = new Dictionary<string, object>();

            result.Add("@activityID", data.ActivityID.ID);
            result.Add("@positionID", data.PositionID.ID);
            result.Add("@billable", data.Billable);
            return result;
        }
 public void Update(Billability data, int id)
 {
     ExecuteNonQuery(QueryBuilder.Update(_tableName, TargetFields, id, _pkField), SetParams(data));
 }
 public void Insert(Billability data)
 {
     ExecuteNonQuery(QueryBuilder.Insert(_tableName, TargetFields), SetParams(data));
 }
 private void SetDropDown(Billability data)
 {
     ViewBag.Position = new SelectList(dbPosition.GetAllActivities, "ID", "Name", data.PositionID.ID);
     ViewBag.Activity = new SelectList(dbActivity.GetAllActivities, "ID", "Name", data.ActivityID.ID);
 }
 public ActionResult Edit(Billability updatedData, int id)
 {
     SetDropDown(updatedData);
     db.Update(updatedData, id);
     return RedirectToAction("Index");
 }
 public ActionResult Create(Billability newData)
 {
     CreateDropDown();
     db.Insert(newData);
     return RedirectToAction("Index");
 }