// PUT api/organizations/7 public void Put(Organization organization) { DataSource<Organization>.Command("UpdateOrganization") .Parameter(new SqlParameter("Id", organization.Id)) .Parameter(new SqlParameter("Name", organization.Name)) .Execute(); }
private static Organization DbToModel(IDataReader reader) { Organization obj = new Organization(); obj.Id = Convert.ToInt32(reader["Id"]); obj.Name = Convert.ToString(reader["Name"]); return obj; }
// POST api/organizations public int Post(Organization organization) { return DataSource<Organization>.Command("AddOrganization") .Parameter(new SqlParameter("Name", organization.Name)) .ExecuteAndReturnId(); }