public ResourceIdMapping ResourceMapping_UpdateFileMapping(uint fileId, uint?resourceId) { ResourceIdMapping ret = null; string query = @" /* ResourceMapping_UpdateFileMapping */ update resourcefilemap set resource_id = ?RESOURCEID where file_id = ?FILEID; select resource_id, 'file' as entity_type, file_id as entity_id from resourcefilemap where file_id = ?FILEID; "; Catalog.NewQuery(query) .With("RESOURCEID", resourceId) .With("FILEID", fileId) .Execute(delegate(IDataReader dr) { List <ResourceIdMapping> temp = ResourceMapping_Populate(dr); if (temp != null && temp.Count > 0) { ret = temp[0]; } }); return(ret); }
public ResourceIdMapping ResourceMapping_InsertFileMapping(uint?resourceId) { ResourceIdMapping ret = null; string query = @" /* ResourceMapping_InsertFileMapping */ insert into resourcefilemap (resource_id) values (?RESOURCEID); select resource_id, 'file' as entity_type, file_id as entity_id from resourcefilemap where file_id = LAST_INSERT_ID(); "; Catalog.NewQuery(query) .With("RESOURCEID", resourceId) .Execute(delegate(IDataReader dr) { List <ResourceIdMapping> temp = ResourceMapping_Populate(dr); if (temp != null && temp.Count > 0) { ret = temp[0]; } }); return(ret); }