/// <summary> /// Updates a guest in the database /// </summary> /// <param name="conn">Open connection to the database</param> /// <param name="inviteId">Unique identifier of the invite the guest is a member of</param> /// <param name="guest">Guest being updated in the database</param> public static void UpdateGuest(SqlConnection conn, Int32 inviteId, Business.Guest guest) { try { sql.SqlCommand cmd = new sql.SqlCommand("UpdateGuest", conn); cmd.Parameters.AddRange(guest.GetParametersForStoredProcedure(inviteId, true)); cmd.ExecuteNonQuery(); } catch (System.Exception e) { throw new UpdateSqlDbObjectException("Could not update guest", e); } }
/// <summary> /// Adds a guest to the database /// </summary> /// <param name="conn">Open connection to the database</param> /// <param name="inviteId">Unique identifier of the invite the guest is a member of</param> /// <param name="guest">Guest being added to the database</param> /// <returns>Unique identifier of the guest, generated by the database</returns> public static Int32 AddGuest(SqlConnection conn, Int32 inviteId, Business.Guest guest) { try { sql.SqlCommand cmd = new sql.SqlCommand("AddGuest", conn); cmd.Parameters.AddRange(guest.GetParametersForStoredProcedure(inviteId, false)); return(cmd.ExecuteScalar <Int32>()); } catch (System.Exception e) { throw new AddSqlDbObjectException("Could not add guest", e); } }